Home  >  Article  >  Web Front-end  >  Evaluate the strength of a user-entered password using Javascript

Evaluate the strength of a user-entered password using Javascript

黄舟
黄舟Original
2016-12-14 15:43:15773browse

Passwords are already an indispensable tool in our lives and work, but an unsafe password may cause us unnecessary losses. As website designers, if we can conduct a security assessment on the password entered by the user on the web page and display the corresponding prompt information, it will be of great help to the user to set a secure password. At the same time, it also makes the website more user-friendly and attractive.

What is a secure password? This program evaluates in the following way.

1. If the password is less than 5 characters, then it is considered a Weak password.

2. If the password only consists of numbers, lowercase letters, uppercase letters or other special symbols, it is considered a weak password.

3. If the password consists of numbers, lowercase letters, uppercase letters or two of other special symbols, it is considered to be a moderately secure password.

4. If the password consists of more than three types of numbers, lowercase letters, uppercase letters or other special symbols, it is considered to be a moderately secure password. A relatively secure password.

This program will display different colors to indicate the strength of the password according to the password entered by the user. The specific program is as follows:

The following is a quotation fragment:



Enter password:
onBlur=pwStrength(this.value)>

Password strength:
height="23" style=display:inline>



Medium Strong

For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn