Laravel Episode 6: Password Reset and Email


episode 6

Episode 6: Password Reset and Email

 

  • Move Login/Logout link to the navbar
  • Add password help link to login page
  • Configure .env to work with mailtrap.io
  • Add value to from so that there is a sent from value. Good idea to use env('FROM_EMAIL')
  • Modify route file with the following
// Password reset link request routes
Route::get('password/email', 'AuthPasswordController@getEmail');
Route::post('password/email', 'AuthPasswordController@postEmail');

// Password reset routes...
Route::get('password/reset/{token}', 'AuthPasswordController@getReset');
Route::post('password/reset', 'AuthPasswordController@postReset');
  • Review /Http/Controllers/Auth/PasswordController.php and add the following
use IlluminateHttpRequest;
use IlluminateMailMessage;
use IlluminateSupportFacadesPassword;

use DB;

protected $redirectTo = '/';

public function getEmail() {
	// code here
}

public function postEmail(Request $request) {
	// code here
}

public function getReset($token) {
	// code here
}
  • postReset() is already configured and does not need modification for this demo
  • Create view files
    • auth/password.blade.php
    • auth/reset.blade.php
    • emails/password.blade.php
  • Review /config/auth.php file. Look at the emails.password setting

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.