Both the front-end and back-end can accomplish this requirement.
Back_end:
Modify the IdentityConfig .cs file in the App_Start folder.
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = true,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
};
After modification:
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = false,
RequireDigit = false,
RequireLowercase = false,
RequireUppercase = false,
};
If your project does not have this file, you can choose the validation method when you create the project.
Front-end :
The front-end can judge each character through JavaScript.
function pass(){
var password = document.getElementById("psw").value;
if(password.length<6){
alert("The password entered must be greater than six digits")
return;}else{
var count =0
for (var i=0;i<password.length;i++) {
if((password[i]>='a' && password[i]<='z')||(password[i]>='A' && password[i]<='Z')){
count++;
}
}
if(count>=1){
alert("legitimate!")
}else{
alert("The password must contain letters")
}
}
}
Best regards,
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.