本文整理汇总了PHP中App\Http\Controllers\Auth\Auth类的典型用法代码示例。如果您正苦于以下问题:PHP Auth类的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Auth类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getLogout
/**
* Overwrite the getLogout function in Illuminate\Foundation\Auth\AuthenticatesUsers;
*/
public function getLogout()
{
\Auth::logout();
\Session::forget('cart_merge');
// custom feature
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/home');
}
开发者ID:vincentgbs,项目名称:mtgmarketplace,代码行数:10,代码来源:AuthController.php
示例2: redirectPath
public function redirectPath()
{
if (\Auth::user()->isUser('user')) {
return '/home';
}
return '/dashboard';
}
开发者ID:mauhftw,项目名称:mizustats,代码行数:7,代码来源:AuthController.php
示例3: authenticate
public function authenticate ()
{
if (Auth::attempt(['mobile' => $mobile, 'password' => $password]))
{
return redirect()->intended('home');
}
}
开发者ID:kukujiabo,项目名称:linpai,代码行数:7,代码来源:AuthController.php
示例4: getLogout
/**
* Log the user out of the application.
*
* @return \Illuminate\Http\Response
*/
public function getLogout()
{
$user = \Auth::user()->name;
\Auth::logout();
\Session::flash('flash_message', $user . ': You have been logged out.');
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
}
开发者ID:dmorgorg,项目名称:photos,代码行数:12,代码来源:AuthController.php
示例5: postReset
/**
* Reset the given user's password.
*
* @param Request $request
* @return Response
*/
public function postReset(Request $request)
{
$this->validate($request, ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed']);
$credentials = $request->only('email', 'password', 'password_confirmation', 'token');
// print_r($credentials);
// die;
$response = $this->passwords->reset($credentials, function ($user, $password) {
echo "reset password";
die;
$user->password = bcrypt($password);
$user->save();
$this->auth->login($user);
});
switch ($response) {
case PasswordBroker::PASSWORD_RESET:
$user = \Auth::user();
if ($user->email_activated != '1') {
$user->email_activated = '1';
$user->email_activated_at = new \DateTime();
$user->save();
}
return redirect($this->redirectPath());
default:
return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
}
}
开发者ID:prathyushasahusoft,项目名称:Angular-Scripts,代码行数:32,代码来源:PasswordController.php
示例6: getLogout
/**
* Override the default getLogout method.
* After logging out, unset/forget the jwt cookie.
*
* @return $this
*/
public function getLogout()
{
//unset the cookie
JWTService::unsetCookie();
\Auth::logout();
return redirect('/');
}
开发者ID:scify,项目名称:city-r-us-web,代码行数:13,代码来源:AuthController.php
示例7: __construct
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
if (\Auth::check()) {
return redirect('/');
}
$this->middleware('guest', ['except' => 'getLogout']);
}
开发者ID:bsmitty54,项目名称:P4,代码行数:12,代码来源:AuthController.php
示例8: postLogin
public function postLogin(\App\Http\Requests\LoginUserRequest $request)
{
if (\Auth::attempt($request->except('_token'), true)) {
return redirect()->intended('/');
}
return back()->withInput()->with(['message' => 'Wrong email or password']);
}
开发者ID:gultaj,项目名称:toster,代码行数:7,代码来源:AuthController.php
示例9: postLogin
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function postLogin(\Illuminate\Http\Request $request)
{
if (\App::environment('local')) {
$this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required']);
} else {
$this->validate($request, [$this->loginUsername() => 'required', 'password' => 'required', 'g-recaptcha-response' => 'required|recaptcha']);
}
// If the class is using the ThrottlesLogins trait, we can automatically throttle
// the login attempts for this application. We'll key this by the username and
// the IP address of the client making these requests into this application.
$throttles = $this->isUsingThrottlesLoginsTrait();
if ($throttles && $this->hasTooManyLoginAttempts($request)) {
return $this->sendLockoutResponse($request);
}
$credentials = $this->getCredentials($request);
if (\Auth::attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
// If the login attempt was unsuccessful we will increment the number of attempts
// to login and redirect the user back to the login form. Of course, when this
// user surpasses their maximum number of attempts they will get locked out.
if ($throttles) {
$this->incrementLoginAttempts($request);
}
return redirect($this->loginPath())->withInput($request->only($this->loginUsername(), 'remember'))->withErrors([$this->loginUsername() => $this->getFailedLoginMessage()]);
}
开发者ID:amirmasoud,项目名称:chakoshLaravelBlog,代码行数:33,代码来源:AuthController.php
示例10: login
public function login(Request $request)
{
// dd(\Crypt::encrypt('[email protected]'));
try {
$email = \Crypt::decrypt($request->get('token'));
} catch (\Exception $e) {
return abort('403', 'Forbidden');
}
$user = User::whereEmail($email)->first();
if (!$user) {
return abort('403', 'Forbidden');
}
if (!$user->account) {
$b2bCompany = \DB::connection('mysql-b2b')->table('companies')->where('user_id', '=', $user->id)->first();
// $b2bCompany = false;
$accountName = $b2bCompany ? $b2bCompany->company_name : $user->email;
$account = new Account();
$account->ip = $request->getClientIp();
$account->name = $accountName;
$account->account_key = str_random(RANDOM_KEY_LENGTH);
$account->save();
$user->account_id = $account->id;
$user->registered = true;
$user->save();
$exists = \DB::connection('mysql')->table('users')->whereId($user->id)->count();
if (!$exists) {
\DB::connection('mysql')->table('users')->insert(['id' => $user->id, 'account_id' => $user->account_id, 'created_at' => $user->created_at, 'updated_at' => $user->updated_at, 'deleted_at' => $user->deleted_at, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'phone' => $user->phone, 'username' => $user->username, 'email' => $user->email, 'password' => $user->password, 'confirmation_code' => $user->confirmation_code, 'registered' => $user->registered, 'confirmed' => $user->confirmed, 'notify_sent' => $user->notify_sent, 'notify_viewed' => $user->notify_viewed, 'notify_paid' => $user->notify_paid, 'public_id' => $user->public_id, 'force_pdfjs' => false, 'remember_token' => $user->remember_token, 'news_feed_id' => $user->news_feed_id, 'notify_approved' => $user->notify_approved, 'failed_logins' => $user->failed_logins, 'dark_mode' => $user->dark_mode, 'referral_code' => $user->referral_code]);
}
}
\Auth::loginUsingId($user->id);
return redirect('/');
}
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:32,代码来源:AutoLoginController.php
示例11: facebookRedirect
public function facebookRedirect()
{
// Automatically log in existing users
// or create a new user if necessary.
SocialAuth::login('facebook', function ($user, $details) {
$existing_user = User::where('email', $details->email)->first();
if ($existing_user !== NULL) {
$existing_user->avatar = $details->avatar;
$existing_user->save();
return $existing_user;
// Tell the package to use this user instead of creating a new one.
}
$user->name = $details->full_name;
$user->avatar = $details->avatar;
$user->email = $details->email;
$user->save();
$roles_allowed = [2];
$user->syncRoles($roles_allowed);
});
// Current user is now available via Auth facade
$user = Auth::user();
if ($user->wasRecentlyCreated == TRUE) {
return redirect('payment')->with('message', 'Update Payment details!');
}
return redirect()->intended('/backend/home');
}
开发者ID:evolvaHQ,项目名称:uwanja,代码行数:26,代码来源:AuthController.php
示例12: getLogout
/**
* Log the user out of the application.
*
* @return \Illuminate\Http\Response
*/
public function getLogout()
{
$user = Auth::user();
$user->status = 'unavailable';
$user->save();
return $this->logout();
}
开发者ID:nicholas-ooi,项目名称:rocketjobs,代码行数:12,代码来源:AuthController.php
示例13: logout
public function logout()
{
\Auth::logout();
// logout user
return \Redirect::to('admin/login');
//redirect back to login
}
开发者ID:devchd,项目名称:metronic,代码行数:7,代码来源:AuthController.php
示例14: getLogout
/**
* Log the user out of the application.
*
* @return \Illuminate\Http\Response
*/
public function getLogout()
{
\Auth::logout();
\Session::flash('flash_message', 'You are Logged Out.');
return redirect('/');
//return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
}
开发者ID:RafaelFlores,项目名称:P4,代码行数:12,代码来源:AuthController.php
示例15: handleProviderCallback
public function handleProviderCallback()
{
//$user = Socialite::with('facebook')->user();
//dd($user);
try {
$user = Socialite::with('facebook')->user();
} catch (Exception $e) {
return redirect('/login/facebook');
}
dd($user);
$authUser = $this->findOrCreateUser($user);
Auth::login($authUser, true);
return redirect('/home');
// // OAuth Two Providers
// $token = $user->token;
//
//// OAuth One Providers
// $token = $user->token;
// $tokenSecret = $user->tokenSecret;
//
//// All Providers
// $user->getId();
// $user->getNickname();
// $user->getName();
// $user->getEmail();
// $user->getAvatar();
//
}
开发者ID:yoannamiteva,项目名称:it_talents,代码行数:28,代码来源:AuthController.php
示例16: authenticate
/**
* Handle an authentication attempt.
*
* @return Response
*/
public function authenticate()
{
if (Auth::attempt(['username' => $email, 'password' => $password, 'is_enabled' => 1])) {
// Authentication passed...
return redirect()->intended('home');
}
}
开发者ID:carriercomm,项目名称:kbsys,代码行数:12,代码来源:AuthController.php
示例17: postRegister
public function postRegister(Request $request)
{
$validator = $this->registrar->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
$this->auth->login($this->registrar->create($request->all()));
$id = DB::getPdo()->lastInsertId();
$user = \Auth::user();
if (Input::get('state') === 'company') {
$user->isCompany = 1;
$user->save();
return Redirect('company/project');
} else {
if (Input::get('state') === 'student') {
$user->isStudent = True;
$user->save();
return Redirect('profile');
} else {
if (Input::get('state') === 'expertise') {
$user->isExpertise = True;
$user->save();
return Redirect('profile');
}
}
}
}
开发者ID:michaelotto126,项目名称:shokes,代码行数:27,代码来源:AuthController.php
示例18: showOptions
/**
* Display the specified resource.
*
* @return Response
*/
public function showOptions()
{
if (\Auth::check()) {
return redirect("/home");
}
return view("login");
}
开发者ID:0zy,项目名称:magistra,代码行数:12,代码来源:LoginController.php
示例19: logout
/**
* 退出登录
*/
public function logout()
{
if (Auth::check()) {
Auth::logout();
}
return Redirect::to('login');
}
开发者ID:suhanyujie,项目名称:digitalOceanVps,代码行数:10,代码来源:AuthController.php
示例20: authenticate
public function authenticate(Request $request)
{
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
// Authentication passed...
return redirect()->intended('/');
}
}
开发者ID:fakharkhan,项目名称:mis,代码行数:7,代码来源:AuthController.php
注:本文中的App\Http\Controllers\Auth\Auth类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论