Search code examples
htmlformsjoomlachange-password

Joomla change password form


I am trying to develop a profile form in Joomla so users can update their information - including changing their password.

However, as can be seen in the below example, the dots just flow beyond the viewable string in the field. Is there a way I can show the correct number of dots for the users password? For example, a user with an 8 character password:

<form>
  <input type="password" name="psw" value="********">
</form>

<form>
  <input type="password" name="psw" placeholder="********">
</form>

I'm getting the input field populated as this:

enter image description here

PS I'm aware aware of identifying password length as in this question. However, with hashing/salting for the type of site this is that it is acceptable


Solution

  • Updated slightly to incorporate the comments.

    In the first example (with "value") what you are doing is setting the actual value of the password to a series of '*' if the form is saved. Then the Joomla password field is doing what it does which is to obfuscate the new password.

    I don't know if you can use a place holder give that the field has a value (although the value is not displayed). If it would the placeholder would be something like "Enter new password". The password will be automatically obfuscated as the user types it. However if a password already exists neither a placeholder nor a value would be rendered by the field.

    From what I can tell you are talking about editing the profile, in which case there is an existing password.

    The Joomla password field never displays back the original password once it has been set, it just provides a blank space for the user to change passwords if desired. If a user is changing their password they should just see an empty field and then one dot for each character they type. The password field cannot show the existing password because it is hashed in the database. There is no way for the field to retrieve the actual password, only the hashed password. The only way to get the real password is for the user to type it in.

    You don't say where $pass is coming from but if you are pulling it from the database it is the hashed value and then it is going to be double hashed on save.

    Is there really a good reason not to use the Joomla profile edit form? Or if there is not to just copy and modify it?