<p>You could always use the <a href="https://craftcms.com/docs/templating/craft.request#getPost" rel="nofollow noreferrer">Craft request object</a> to repopulate the fields, however I don't think it's common practice to repopulate password fields for security reasons.</p>

<p>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.</p>

CC BY-SA 3.0
2017-09-20T09:28:16.443Z
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
CC BY-SA 3.0
2017-09-18T05:39:07.190Z
2017-09-18T05:39:07.190Z
Andris Sevcenko
<p>I want to customize the user-registration-form with error/success-states.<br>
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.</p>

<pre><code>{% if account is defined %}
&lt;input id="password" name="password" type="password" value="{{account.password}}"&gt;
{% endif %}
</code></pre>

<p>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...<br>
Not setting the value, but set the state to success with an empty field is not much better.</p>

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

<p>Tnx</p>

<p><a href="https://i.sstatic.net/bh1gj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bh1gj.png" alt="enter image description here"></a></p>

<users><registration><password>
How to get the original entered password value on registration form error?
# How to get the original entered password value on registration form error?

(Asked by: username_0 on 2017-09-17)

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 %}

{% 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.
Tnx

**Tags:** users, registration, password

---

## 1 answers

### Answer by username_1 on 2017-09-18. Score: 3 | Accepted answer

You could always use the [Craft request object](https://craftcms.com/docs/templating/craft.request#getPost) 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.

> **Comments:**
> **username_0**: 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!  

---

