Set Password Form

When a user forgets their password, Craft will send them an email with a URL to set a new password. That URL is defined by your setPasswordPath config setting, which is “setpassword” by default.

If you want the front-end of your site to support password resetting, you need to create a template at the path specified by the ”setPasswordPath” config setting.

Within that template, place the following code:

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    {{ actionInput('users/set-password') }}
    {{ hiddenInput('code', code) }}
    {{ hiddenInput('id', id) }}

    <h3><label for="newPassword">New Password</label></h3>
    <input id="newPassword" type="password" name="newPassword">
    {% if errors is defined %}
        <ul class="errors">
            {% for error in errors %}
                <li>{{ error }}</li>
            {% endfor %}
    {% endif %}

    <input type="submit" value="Submit">

After the user successfully logs in, they will be redirected to the path defined by the setPasswordSuccessPath config setting.