Created
April 16, 2018 16:23
-
-
Save acacha/6cbfc7f22897a2a33bd3450facd38d54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Auth; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; | |
/** | |
* Class ForgotPasswordController. | |
* | |
* @package App\Http\Controllers\Auth | |
*/ | |
class ForgotPasswordController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Password Reset Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller is responsible for handling password reset emails and | |
| includes a trait which assists in sending these notifications from | |
| your application to your users. Feel free to explore this trait. | |
| | |
*/ | |
use SendsPasswordResetEmails; | |
/** | |
* Display the form to request a password reset link. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function showLinkRequestForm() | |
{ | |
return view('welcome', [ | |
'action' => 'request_new_password' | |
]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Auth; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\AuthenticatesUsers; | |
/** | |
* Class LoginController. | |
* | |
* @package App\Http\Controllers\Auth | |
*/ | |
class LoginController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Login Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller handles authenticating users for the application and | |
| redirecting them to your home screen. The controller uses a trait | |
| to conveniently provide its functionality to your applications. | |
| | |
*/ | |
use AuthenticatesUsers; | |
/** | |
* Where to redirect users after login. | |
* | |
* @var string | |
*/ | |
protected $redirectTo = '/home'; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('guest')->except('logout'); | |
} | |
/** | |
* Show the application's login form. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function showLoginForm() | |
{ | |
return view('welcome', [ | |
'action' => 'login' | |
]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Auth; | |
use App\User; | |
use App\Http\Controllers\Controller; | |
use Hash; | |
use Illuminate\Support\Facades\Validator; | |
use Illuminate\Foundation\Auth\RegistersUsers; | |
/** | |
* Class RegisterController. | |
* | |
* @package App\Http\Controllers\Auth | |
*/ | |
class RegisterController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Register Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller handles the registration of new users as well as their | |
| validation and creation. By default this controller uses a trait to | |
| provide this functionality without requiring any additional code. | |
| | |
*/ | |
use RegistersUsers; | |
/** | |
* Where to redirect users after registration. | |
* | |
* @var string | |
*/ | |
protected $redirectTo = '/home'; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('guest'); | |
} | |
/** | |
* Get a validator for an incoming registration request. | |
* | |
* @param array $data | |
* @return \Illuminate\Contracts\Validation\Validator | |
*/ | |
protected function validator(array $data) | |
{ | |
return Validator::make($data, [ | |
'name' => 'required|string|max:255', | |
'email' => 'required|string|email|max:255|unique:users', | |
'password' => 'required|string|min:6|confirmed', | |
]); | |
} | |
/** | |
* Show the application registration form. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function showRegistrationForm() | |
{ | |
return view('welcome', [ | |
'action' => 'register' | |
]); | |
} | |
/** | |
* Create a new user instance after a valid registration. | |
* | |
* @param array $data | |
* @return \App\User | |
*/ | |
protected function create(array $data) | |
{ | |
return User::create([ | |
'name' => $data['name'], | |
'email' => $data['email'], | |
'password' => Hash::make($data['password']), | |
]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Auth; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\ResetsPasswords; | |
use Illuminate\Http\Request; | |
/** | |
* Class ResetPasswordController. | |
* | |
* @package App\Http\Controllers\Auth | |
*/ | |
class ResetPasswordController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Password Reset Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller is responsible for handling password reset requests | |
| and uses a simple trait to include this behavior. You're free to | |
| explore this trait and override any methods you wish to tweak. | |
| | |
*/ | |
use ResetsPasswords; | |
/** | |
* Where to redirect users after resetting their password. | |
* | |
* @var string | |
*/ | |
protected $redirectTo = '/home'; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('guest'); | |
} | |
/** | |
* Display the password reset view for the given token. | |
* | |
* If no token is present, display the link request form. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param string|null $token | |
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View | |
*/ | |
public function showResetForm(Request $request, $token = null) | |
{ | |
return view('welcome')->with([ | |
'token' => $token, | |
'email' => $request->email, | |
'action' => 'reset_password', | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment