Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a success flash message for the password reset functionality of Laravel?

I'm using Laravel 5.1 and the built-in auth functionality. When testing it, however, I noticed there is no "Success" message when a user fills out the forgotten password form, the page simply refreshes, although the form does work.

How can I set a success variable for the forgotten password tool? I can't find the method that controls this anywhere.

Thanks

like image 938
Mike Avatar asked Dec 08 '22 01:12

Mike


1 Answers

If you’re using Laravel’s built-in password reset functionality, then it does have a success message. You can see it here: https://github.com/laravel/framework/blob/5.1/src/Illuminate/Foundation/Auth/ResetsPasswords.php#L95

You merely need to listen for it in your view and display it if it’s there:

@if (session('status'))
   <p class="alert alert-success">{{ session('status') }}</p>
@endif

This will display the default message, which is:

Your password has been reset!

If you want to change this message, just change the relevant line in resources/lang/en/passwords.php.

like image 114
Martin Bean Avatar answered Dec 26 '22 10:12

Martin Bean