timokfine's avatar

Flash message on successful password reset?

How do I pass a flash message to the page after a successful password reset?

Inside ResetsPasswords.php I noticed a function called postReset() which logs the user in after a successful reset.

I'm guessing this is what needs to be changed? Or do I need to edit the redirectPath() function instead? What's the best practice for making changes to this file? I know I shouldn't be editing it directly.

Thanks!

0 likes
8 replies
deadlockgB's avatar

Do you have any template logic that displays the flash message? Do you use the stock Laravel 5 installation?

bobbybouwmann's avatar

Are you sure that your code is executed?

case PasswordBroker::PASSWORD_RESET:
    dd('executed');
    return redirect($this->redirectPath())->with(['flash_success' => 'Password reset.']);
deadlockgB's avatar

shouldn't

return redirect($this->redirectPath())->with(['flash_success' => 'Password reset.']);

be

return redirect($this->redirectPath())->with('flash_success' , 'Password reset.');
bashy's avatar

It still went through and reset the password and logged the user in (default behaviour).

Need to solve that first.

bashy's avatar

I thought you were already overriding them :P

1 like
tonio@furbo.ch's avatar

Best is to overwrite the trait method like this: => ResetPasswordController

use ResetsPasswords { reset as public _reset; };

...

public function reset(Request $request) { Session::flash('success', 'Dein Passwort wurde zurückgesetzt.'); return $this->_reset($request); }

1 like

Please or to participate in this conversation.