Forgot Password Form

If your using Enact Client Edition you can provide your own forgot password page.

Heres a basic one which could be located at enact/template/forgot-password.html and accessed via yoursite.com/forgot-password.

{% extends "_layout.html" %}

{% do enact.view.title('Forgot Password | ' ~ enact.siteName ) %}

{% block content %}
    {% if enact.session.getFlash('passwordResetSent') == true %}
        <div class='alert-box success'>If your email exists you will receive a password reset email shortly!</div>
    {% else %}
        <form method='post'>
            {{ enact.csrfTokenInput }}
            <input type='hidden' name='enactAction' value='sendPasswordReset'/>
            <label>Email</label>
            <input type='email' name='email' required/>
            <input type='submit' value='Get Reset Email'/>
            {% if enact.session.getFlash('passwordResetSent') == false %}
                <div class='alert-box warning'>Could not send password reset email!</div>
            {% endif %}
        </form>
    {% endif %}
{% endblock %}

Want to do AJAX?

Include the variable ajax in the POST data and you will get a JSON response back that looks like:

  • d – (for data) Set to a true or false on whether the email was sent.

  • e – (for error) Whether an error occurred while attempting to send the email.