/    Sign up×
Community /Pin to ProfileBookmark

password validation (java script)

there is a condition for password validation.

>

lowercase,uppercase,numeric,specialcharacters are allowed for password setting.
>in the four case any three is compulsory.
>i did it in javascript.
>if you change the language Reference to french or other language.
>The special characters are have some different to different language.
>how can i internationalized for password validation in javascript
give some idea

var iChars = “!@#$%^&*()+=-[]‘;,./{}|”:<>?”;
var SC=false;

for (var i = 0; i < document.forms[0].password.value.length; i++) {
if (iChars.indexOf(document.forms[0].password.value.charAt(i)) != -1) {
alert (“verygood”);
SC=true;
break;
}
}
if(document.forms[0].password.value!=null && Trim(document.forms[0].password.value).length>=8 && ((document.forms[0].password.value).match(/([a-z])/)&&(document.forms[0].password.value).match(/([A-Z])/)) && ((document.forms[0].password.value).match(/([0-9])/)) && !SC)
{
numalphaSC=true;
alert(“Good”);
}
if(document.forms[0].password.value!=null && Trim(document.forms[0].password.value).length>=8 && (!(document.forms[0].password.value).match(/([a-z])/)&&(document.forms[0].password.value).match(/([A-Z])/)) && ((document.forms[0].password.value).match(/([0-9])/)) && SC)
{
numalphaSC=true;
alert(“marvellous”);
}
if(document.forms[0].password.value!=null && Trim(document.forms[0].password.value).length>=8 && ((document.forms[0].password.value).match(/([a-z])/)&&!(document.forms[0].password.value).match(/([A-Z])/)) && ((document.forms[0].password.value).match(/([0-9])/)) && SC)
{
numalphaSC=true;
alert(“super”);
}
if(document.forms[0].password.value!=null && Trim(document.forms[0].password.value).length>=8 && ((document.forms[0].password.value).match(/([a-z])/)&&(document.forms[0].password.value).match(/([A-Z])/)) && (!(document.forms[0].password.value).match(/([0-9])/)) && SC)
{
numalphaSC=true;
alert(“Fantastic”);
}
if(document.forms[0].password.value!=null && Trim(document.forms[0].password.value).length>=8 && ((document.forms[0].password.value).match(/([a-z])/)&&(document.forms[0].password.value).match(/([A-Z])/)) && ((document.forms[0].password.value).match(/([0-9])/)) && SC)
{
numalphaSC=true;
alert(“Wonderful”);
}

if(!numalphaSC)
{
alert(“nasty”)
}

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @allavudeen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...