显示与原始密码具有相同字符数的虚拟密码文本

时间:2015-07-21 06:08:27

标签: javascript html concrete5

我有一个编辑用户页面,我必须显示一些用户详细信息,例如用户登录的用户名,名字,姓氏和密码。 我正在使用concrete5所以我 cant 解密密码以便在密码字段中显示。(input type="password") 我必须显示一个虚拟密码字段,该字段应该与密码具有相同的字符数。是否有任何想法生成与原始密码具有相同数量星号的密码字段。

1 个答案:

答案 0 :(得分:2)

我会使用静态长度代替存储密码长度,这不是一个很好的安全决策。以下是一些如何使用占位符为用户提供良好体验而不泄露密码长度的示例:

<p>Use a static length password representation</p>
<input type="password" name="password" placeholder="*************"><br>
<input type="password" name="password" placeholder="*************"><br>
<input type="password" name="password" placeholder="*************"><br>

<p>Use prompts for the passwords instead</p>
<input type="password" name="password" placeholder="Current Password"><br>
<input type="password" name="password" placeholder="New Password"><br>
<input type="password" name="password" placeholder="Confirm New Password"><br>

<p>Or just leave them blank (assuming they already have labels)</p>
<input type="password" name="password"><br>
<input type="password" name="password"><br>
<input type="password" name="password"><br>

相关问题