filmov
tv
JavaScript password strength checker

Показать описание
Link for all dot net and sql server video tutorial playlists
Link for slides, code samples and text version of the video
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
In this video we will discuss how to implement a simple password strength checker using JavaScript.
As we type the password in the password TextBox, the strength of the password should be displayed in a label control.
The password strength is determined based on the following scoring criteria.
If the password contain atleast 8 characters - 20 Points
If the password contain atleast 1 lowercase letter - 20 Points
If the password contain atleast 1 uppercase letter - 20 Points
If the password contain atleast 1 number - 20 Points
If the password contain atleast 1 special character - 20 Points
The password strength is determined using the following scale.
Password Score - Password Strength
]= 100 - Strong
]= 80 - Medium
]= 60 - Weak
[ 60 - Very Weak
Example :
[asp:TextBox ID="TextBox1" runat="server" TextMode="Password"
onkeyup="checkPasswordStrength()"]
[/asp:TextBox]
[asp:Label ID="lblMessage" runat="server"][/asp:Label]
[script type="text/javascript"]
function checkPasswordStrength()
{
var specialCharacters = "!£$%^&*_@#~?";
var passwordScore = 0;
// Contains special characters
{
{
passwordScore += 20;
break;
}
}
// Contains numbers
if (/\d/.test(password))
passwordScore += 20;
// Contains lower case letter
if (/[a-z]/.test(password))
passwordScore += 20;
// Contains upper case letter
if (/[A-Z]/.test(password))
passwordScore += 20;
passwordScore += 20;
var strength = "";
var backgroundColor = "red";
if (passwordScore ]= 100)
{
strength = "Strong";
backgroundColor = "green";
}
else if (passwordScore ]= 80)
{
strength = "Medium";
backgroundColor = "gray";
}
else if (passwordScore ]= 60)
{
strength = "Weak";
backgroundColor = "maroon";
}
else
{
strength = "Very Weak";
backgroundColor = "red";
}
}
[/script]
Link for slides, code samples and text version of the video
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
In this video we will discuss how to implement a simple password strength checker using JavaScript.
As we type the password in the password TextBox, the strength of the password should be displayed in a label control.
The password strength is determined based on the following scoring criteria.
If the password contain atleast 8 characters - 20 Points
If the password contain atleast 1 lowercase letter - 20 Points
If the password contain atleast 1 uppercase letter - 20 Points
If the password contain atleast 1 number - 20 Points
If the password contain atleast 1 special character - 20 Points
The password strength is determined using the following scale.
Password Score - Password Strength
]= 100 - Strong
]= 80 - Medium
]= 60 - Weak
[ 60 - Very Weak
Example :
[asp:TextBox ID="TextBox1" runat="server" TextMode="Password"
onkeyup="checkPasswordStrength()"]
[/asp:TextBox]
[asp:Label ID="lblMessage" runat="server"][/asp:Label]
[script type="text/javascript"]
function checkPasswordStrength()
{
var specialCharacters = "!£$%^&*_@#~?";
var passwordScore = 0;
// Contains special characters
{
{
passwordScore += 20;
break;
}
}
// Contains numbers
if (/\d/.test(password))
passwordScore += 20;
// Contains lower case letter
if (/[a-z]/.test(password))
passwordScore += 20;
// Contains upper case letter
if (/[A-Z]/.test(password))
passwordScore += 20;
passwordScore += 20;
var strength = "";
var backgroundColor = "red";
if (passwordScore ]= 100)
{
strength = "Strong";
backgroundColor = "green";
}
else if (passwordScore ]= 80)
{
strength = "Medium";
backgroundColor = "gray";
}
else if (passwordScore ]= 60)
{
strength = "Weak";
backgroundColor = "maroon";
}
else
{
strength = "Very Weak";
backgroundColor = "red";
}
}
[/script]
Комментарии