I want to customize the user-registration-form with error/success-states.
If, for example, the user enters a wrong email, but correct username and password, it would be nice to set the value of the password input field back to the original entered password - like the username-field does.

{% if account is defined %}
<input id="password" name="password" type="password" value="{{account.password}}">
{% endif %}

In matter of UX, this does not really works good, because it's the hashed version of the password. The origin was much shorter. So the user could be a bit surprised...
Not setting the value, but set the state to success with an empty field is not much better.

Is it possible, to set the origin entered password as the value?
If, does this work on resend the form?
Any other ideas are welcome.


enter image description here


You could always use the Craft request object to repopulate the fields, however I don't think it's common practice to repopulate password fields for security reasons.

Another thing that is considered bad practice is differentiating behaviour for partially correct credentials - the response from the web server should always be the same whether one part or multiple parts are missing from a correct authorization submission to prevent information disclosure to a potential attacker.

  • 1
    Andris, i tried craft.request.getParam('password') and that works, but i also rethink with your advice and do not repopulate the password-field. Tnx! – d3nn15 Sep 20 '17 at 9:28

Your Answer

