How to override / add passwords to the browser in Laravel?

Using Laravel 5.2

I need to rewrite a couple of features / add some new stuff to the reset password process. I know that I can rewrite functionality in Illuminate\Foundation\Auth\ResetsPasswords using a password controller that comes out of tin.

I also need to make changes to Illuminate\Contracts\Auth\PasswordBroker . My goal is to have a prompt to set the initial password using the existing reset password. The only problem is the sendResetLink function.

This function receives a password token and sends an email using the reset email view. I still need the reset password functionality, but I don’t have an invitation letter with "w74> your password".

How can i do this? I think I can duplicate and customize the functionality in the reset classes to use the invitation view for email, but I cannot figure out how to extend the broker class to make this work.

+7
php laravel-5
source share
1 answer

I struggled with the same. I added the setEmailView () method to my custom PasswordBroker and called it before sending resetlink to AuthController, but this violated the normal reset password function.
So, I completely abandoned this and went for a much simpler approach. In AuthController.php, enter the variable in the password pattern.

 view()->composer('auth.emails.password', function($view) { $view->with(['register'=>true]); }); Password::sendResetLink(['email'=>$data['email']], function($message) { $message->subject('Registration Email'); }); 

Then in the template auth / emails / password.blade.php

 @if ( isset($register) ) Whatever you want to say in registration Email. @else Normal password reset Email here. @endif 
+2
source share

All Articles