How to customize password reset email in Laravel 5.3

Posted 2 years ago by getvma

I originally added this issue in github:

Here is that post;

I am running a Dual Auth:Guard application.

in the frontend routes i use the standard auth() scaffold and install.

// routes/web.php
// using default middleware and guard
Route::get('/', function () {
    return view('welcome');


Route::get('/home', '[email protected]');

The backend route has the following;

//  middleware 'web, auth:admin'
// prefixed 'admin' in RouteServiceProvider

// Authentication Routes...
Route::group(['namespace' => 'Admin\Auth'], function (\Illuminate\Routing\Router $router) {

    // Login...
    $router->get('login', ['as'=>'admin.login', 'uses'=>'[email protected]']);
    $router->post('login', '[email protected]')->name('admin.login');
    $router->get('logout', ['as'=>'admin.logout', 'uses'=>'[email protected]']);

    // Registration Routes...
    if (config('')) {
        $router->get('register', '[email protected]')->name('admin.register');
        $router->post('register', '[email protected]');

    // Password Reset Routes...
    $router->get('password/reset', '[email protected]')->name('admin.password.reset');
    $router->post('password/email', '[email protected]');
    $router->get('password/reset/{token}', '[email protected]')->name('admin.password.token');
    $router->post('password/reset', '[email protected]');

I copied all App\Http\Controllers\Auth* into App\Http\Controllers\Admin\Auth\ and customized guards and brokers as per the documentation. Additionally i created all customized views inside its own backend\auth path.... and... made all of the other configurations to support multiple auth guards.

Everything works! ..... Almost!

The password reset email link that is sent by the system only directs the user to the '/password/reset' path. which uses the default guard and default redirects. In order for admins to succefully reset their password the path needs to change to '/admin/password/reset' so that the link can use the correct auth guard and redirects as customized on those controllers.

There is a resetNotifier() method in the SendsPasswordResetEmails trait but there is no documentation as to how to use it. I understand that it can be overwritten in ForgotPasswordController.php but exactly what you do inside of resetNotifier() escapes me. Or, perhaps its not even related..

The actual email message is embedded in the following Notifications class which i think is pretty darn cool...

namespace Illuminate\Auth\Notifications;

use Illuminate\Notifications\Notification;

class ResetPassword extends Notification
     * The password reset token.
     * @var string
    public $token;

     * Create a notification instance.
     * @param  string  $token
     * @return void
    public function __construct($token)
        $this->token = $token;

     * Get the notification's channels.
     * @param  mixed  $notifiable
     * @return array|string
    public function via($notifiable)
        return ['mail'];

     * Get the notification message.
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\MessageBuilder
    public function message($notifiable)
        return $this->line('You are receiving this email because we received a password reset request for your account. Click the button below to reset your password:')
                    ->action('Reset Password', url('password/reset', $this->token).'?email='.urlencode($notifiable->email))
                    ->line('If you did not request a password reset, no further action is required.');

I am looking for some guidance on this issue.

Thanks Victor

Please sign in or create an account to participate in this conversation.