I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
I'm quite new to jQuery, and I've written a simple function to check the strength of a password for each keypress.
The idea is that every time a user enters a character, the contents is evaluated to test the strengh of the password they have entered... I'm sure everyone has seen these before.
Anyhow, the logic I have used is that no password begins with a value of 1. When a lower-case character is used, the score increments to 2. When a digit is used the score increments by 1 again, same for when an uppercase character is used and when the password becomes 5 or more characters long.
What is returned is the strength of the password so far as a value from 1 to 5 every time a key is pressed.
So, about my question. The way that I've done it doesn't seem very jQuery like... almost like I may as well have just done straight javascript. Also I was wondering about my logic. Have I done anything done or overlooked something? Any suggestions from smarter people than myself?
Any suggestions or advice would be appreciated.
$(document).ready(function(){
$("#pass_strength").keyup(function() {
var strength = 1;
/*length 5 characters or more*/
if(this.value.length >= 5) {
strength++;
}
/*contains lowercase characters*/
if(this.value.match(/[a-z]+/)) {
strength++;
}
/*contains digits*/
if(this.value.match(/[0-9]+/)) {
strength++;
}
/*contains uppercase characters*/
if(this.value.match(/[A-Z]+/)) {
strength++;
}
alert(strength);
});
});
implementation for scoring based on variation, mess and length:
function scorePass(pass) {
let score = 0;
// variation range
score += new Set(pass.split("")).size * 1;
const charCodes = [...new Set(pass.split(''))].map(x=>x.toLowerCase().charCodeAt(0));
// shuffle score - bonus for messing things up
for (let i=1; i < charCodes.length;i++)
{
const dist = Math.abs(charCodes[i-1]-charCodes[i]);
if (dist>60)
score += 15;
else if (dist>8)
score += 10;
else if (dist>1)
score += 2;
}
// bonus for length
score += (pass.length - 6) * 3;
return parseInt(score);
}
abcעfדg94a
> jefPYM583^
> abcABC!@#$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.