Login-related function points and implementation of user name and password encryption rules

1. Login Forgot Password
_
_ , Forgot password, type, verification code, next automatic login, login button, cancel button Copyright , registration, sky blue tone, center, left and right, up and down, reset, help, English interface, foreground, background Use the following account to log in directly ( QQ, Weibo, WeChat, Taobao, Alipay, etc.) manage users, anonymous users, member login and logout , authentication method, avatar, keypad input, drag and drop login, refresh input, obtain dynamic verification code, system settings, refresh version upgrade, logo, language, theme, and the verification code cannot be seen and replaced, free login for ten days, play with WeChat friends, play with QQ friends, have read and agreed to the <<User Agreement>>, games, office, constituencies, cookies, various lines Various industries, last login, verification code type: static dynamic mobile phone number with static background and calculation formula, anti-brute force crack input error 5 times the account is locked, the value passed in the password js is encrypted by MD5 Fragmental knowledge point 1, remove the space   trim() Function, replace() function, split("").join("") function 2. Empty the   reset() function, the keyword reset changes the function name 3. Move the mouse in and out mouseenter(), mouseleave() $(this). find(div).stop(false,true).slidedown();



















$(this).find(div).stoop(false,true).hide();
4. Password control
cannot be all numbers, all English

plugin js file passwordStrength.js

(function(){
   if(!window['EBWF']){
	   window['EBWF'] = {};
   }
   function passwordStrength(password){
   	   // Private properties	
       var defaultLength = 8;
       var owner = this;
       // Private method
       function initCheck(password){
           if(!password||password.length <8){
              throw new Error(emptyandlength+defaultLength);
           }
       }
       
       function min(a,b,c){
         if(a>b){
             if(b>c){
                return c;
             }else{
                return b;
             }
         }else{
        	 if(a>c){
                return c;
             }else{
                return a;
             }		
         }
       }
       function getDistance(a, b){
        var aL = a.length;
        var bL = b.length;
        var distance = new Array(aL+1);
        for(var i = 0; i <= aL; i++){
            distance[i] = new Array(bL+1);
        }
        for(var i = 0; i <= aL; i++){
            distance[i][0]=i;
            
        }
        for(var j=0;j<=bL;j++){
            distance[0][j] = j;
        }
        for(var i =1 ; i <= aL;i++){
            for(var j=1;j<=bL;j++){
                var ac = a.charAt (i-1);
                var bc = b.charAt (j-1);
                if(ac==bc){
                    distance[i][j]= distance[i-1][j-1];
                }else{
                    var v1 = distance[i][j-1];
                    var v2 = distance[i-1][j-1];
                    var v3 = distance[i-1][j];
                    distance[i][j]= min(v1,v2,v3)+1;
                }
            }
        }
        return distance[aL][bL];
    }
       
       initCheck(password);
       this.password = password;
       // Priviledged method (still public)
       this.setPassword = function(password){
            initCheck(password);
            this.password = password;
   	   };
   	   this.isSimilar=function(target,limitStep){
   	   	var i = getDistance(target,this.password);
        
        if(i<=limitStep){
            return true;
        }else{
            return false;
        }
   	   };
       
   
   }
   passwordStrength.prototype.equalsIgnoreCase = function(target){
     return this.password.toUpperCase()==target.toUpperCase();
   };
   passwordStrength.prototype.evaluateLength = function(min, max){
        if(this.password.length< min||this.password.length>max){
            return false;
        }else{
            return true;
        }
    };
   passwordStrength.prototype.atLeastLength = function(length){
      if(this.password.length < length){
         return false;
      }else{
         return true;
      }
   };
   passwordStrength.prototype.isAllCharacters= function(){
        var allCharacters = / ^ ([a-zA-Z]) + $ /;
        if(allCharacters.test(this.password)){
            return true;
        }else{
        	return false;
        }
   };
   passwordStrength.prototype.isAllLowerCharacters= function(){
        var allLowerCharacters =/^([a-z])+$/;
        if(allLowerCharacters.test(this.password)){
            return true;
        }else{
        	return false;
        }
   };
   passwordStrength.prototype.isAllUpperCharacters= function(){
        var allUpperCharacters =/^([A-Z])+$/;
        if(allUpperCharacters.test(this.password)){
            return true;
        }else{
        	return false;
        }
   };
   passwordStrength.prototype.isAllDigits= function(){
        var allDigits = / ^ ([0-9]) + $ /;
        if(allDigits.test(this.password)){
            return true;
        }else{
        	return false;
        }
   };
   passwordStrength.prototype.hasThreeConsecutiveSame= function(){

        var length = this.password.length;
        for(var i=0;i<length-2;){
            var c1= this.password.charAt(i);
            var c2= this.password.charAt(i+1);
            var c3= this.password.charAt(i+2);
            if(c3!=c2){
                i=i+2;
            }else if(c1!=c2){
                i=i+1;
            }else{
                return true;
            }
        }
        return false;
   };
   
   passwordStrength.prototype.hasSpecialCharacter= function(){
         var length = this.password.length;
        //Character a = '0';

        for(var i=0; i< length; i++){
            var c = this.password.charAt(i);
            var rv = ((c-'A')>-1&&(c-'z')<1)||((c-'0')>-1 && (c-'9')<1);
            if(!rv){
                return true;
            }
        }
        return false;
   };
   
   passwordStrength.prototype.hasThreeConsecutiveValue= function(){
   		var length = this.password.length;
        for(var i=0;i<length-2;){
           
            var c2= this.password.charAt(i+1);
           
            if((c2>'0'&&c2<'9')||(c2>'a'&&c2<'z')||(c2>'A'&&c2<'Z')){
                var c1= this.password.charAt(i);
                var c3= this.password.charAt(i+2);
                if((c2*2 == c1+c3)&&(c2!=c1)){
                    return true;
                }else if((c2==c3-1)||(c2==c3+1)){
                    i=i+1;
                }else{
                    i=i+1;
                }
            }else{
                i = i+2;
            }
            
        }
        return false;
   
   };
    passwordStrength.prototype.basicEvaluate= function(length){
    	if(!this.atLeastLength(length)){
            return false;
        }else if(this.isAllCharacters()){
            return false;
        }else if(this.isAllDigits()){
            return false;
        }else if(this.hasThreeConsecutiveSame()){
            return false;
        }else{
            return true;
        }
    
    };
   
    window['EBWF']['passwordStrength'] = passwordStrength;

})();

****************Settings in the jsp page**************************** ********
/**
* Password verification
*
*/
function resetPwdCheck () {
	var new_pwd = jQuery.trim(jQuery("#new_pwd").val());
	var confim_pwd = jQuery.trim(jQuery("#confim_pwd").val());
	if(new_pwd == ""){
		alert(please_fillin_password); /*"Please fill in the password"*/
		return false;
	}
	if (confim_pwd == "") {
		alert(please_confirm_password); /*"Please confirm the password"*/
		return false;
	}	
	if (new_pwd != confim_pwd) {
		alert(inputpassword_consistent); /*"The passwords filled in twice are inconsistent"*/
		return false;
	}
	if(new_pwd != "" && validateCharLength(new_pwd) > 50){
		alert(newpassword_toolong); /*"The new password is too long"*/
		return false;
	}
	
	//Administrator password complexity check
	var passwordStrengthConstructor =  window['EBWF']['passwordStrength'];
	 try{
	    var password = new passwordStrengthConstructor(new_pwd);
	    if (password.isAllDigits()==true){
			alert(password_cannot_numbers); /*"Password cannot be all numbers"*/
			return false;
		}
		if (password.isAllCharacters()==true){
			alert(password_cannotallletter); /*"Password cannot be all letters"*/
			return false;
		}
	
	 }catch(e){
	    alert(e.message);
	    return false;
	 }
	 
	return true;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326220879&siteId=291194637