1

Quick question about password reset (forgot a password on the front-end)

So I have set my
'setPasswordSuccessPath' => 'login'
so that when the new password is set, they will be taken to this login screen.

Is there anyway i can detect this has come from this process, so I can show a little flash message to confirm their password has been reset? I'd like to give some visual feedback, without a whole separate interim page.

1

The way I handle this is by simply includeing the same template as the login page and passing a Twig variable along with it.

So more specifically, my setPasswordSuccessPath is set to a unique template called password-was-reset, which has the following code in it and nothing else:

{% include 'login' with { passwordWasReset: true } %}

You can then read that variable in your login template like this - as you can see I'm also doing the same thing with my account activation template:

    {% if passwordWasReset is defined and passwordWasReset and errorMessage is not defined %}       
        <p>Your password was reset successfully. Please login below.</p>        
    {% endif %}

    {% if accountWasActivated is defined and accountWasActivated and errorMessage is not defined %}
        <p>Your account was activated successfully. Please login below.</p>
    {% endif %}

    ...

    <login form here>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.