Skip to main content
Topic: Password Visibilty (Read 130 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Password Visibilty

Hello all :)

I am a (very) new user so please forgive me if I am asking a question that is as old as the hills - FWIW I did do a forum search and could not see a relevant result.

Anyway, I know it is not a huge issue but I would like to ask for a check box which users could check if they wanted to see what they were typing into the password box.

Maybe there are reasons why this is not good but I always like to see what I type in the password box !

Rgds
Paul
Liverpool UK
PS thanks so much for the forum software. I really like how the default theme looks out of the box. I am only part way through exploring all the functionality but so far it all looks great to me :)

Re: Password Visibilty

Reply #1
You can easily add such functionality with just a few lines of JavaScript.  All the JS does is change the password input box from type password to type text (and back).

I'd probably add the JS function to the script.js file and then the needed checkbox to the login.template.php file.

The JS would be something like
Code: [Select]
function showPass()
{
let show_pass = document.getElementById('passwrd');
if (show_pass.type === 'password')
{
show_pass.type = 'text';
}
else
{
show_pass.type = 'password';
}
}

And to use it add the checkbox after the password input box in the login form along the lines of (depends on what the current markup is)
Code: [Select]
<dt>
<label for="showpass">', $txt['show_password'], ':</label>
</dt>
<dd>
<input type="checkbox" id="showpass" onclick="showPass()" />
</dd>

You would also need to add the definition for $txt['show_password'] to the language file.
Be safe, Be kind, Happy Programing