• 验证密码复杂度


    1.要求:验证密码的复杂度,要求至少要包含6个字符 ;包含以下四类字符中的三类字符:英文小写字母(a 到 z);英文大写字母(A 到 Z);10 个基本数

                      字(0 到 9);非字母字符(例如 !、$、#、%)。

    2.工程类型:IS2010  installscript

    3.定义变量:

                string DBPassword; 
                INT  i,iLength;
                number Nmuber,Uppercase,Lowcase,Special,times;

    4,具体脚本

            iLength = StrLengthChars (DBPassword);//获取输入的密码长度
            if(iLength<6)then     //如果小于6个字符,就弹出提示信息,并且返回到密码输入窗口界面

                         MessageBox(@PWLength,INFORMATION);
                        goto Dlg_EnterPassword; 
              
            else   //如果大于6个字符
               
                 
                           //初始化变量 
                            Nmuber=0;
                            Uppercase=0;
                            Lowcase=0;
                            Special=0;
                          
                             
                        for i = 0 to iLength step 1   //检测密码 ,从第一个字符到最后一个字符
                                         
                           

                             //如果被检测的字符在48--57区间,表示是数字;每检测到一个数字,Nmuber变量就增加

                           //1 ,最后得到输入的密码中总共有几个数字

                            if (DBPassword[i]>=48 && DBPassword[i]<=57)then     

                                     Nmuber=Nmuber+1;
                            endif; 
                            
                         
                            //如果被检测的字符在65--90区间,表示是大写字母;每检测到一个大写字母,

                          //Uppercase变量就增加1 ,最后得到输入的密码中总共有几个大写字母

             
                            if (DBPassword[i]>=65 && DBPassword[i] <=90)then
                                
                                 Uppercase=Uppercase+1;
                                
                            endif;             
                           
                           
                           //如果被检测的字符在97--122区间,表示是大写字母;每检测到一个小写字母,

                          //Lowcase变量就增加1 ,最后得到输入的密码中总共有几个小写字母

       
                            if (DBPassword[i]>=97 && DBPassword[i] <=122)then      
                               
                                Lowcase=Lowcase+1;
                            endif;    
                               
                          
                           //检测非字母字符(例如 !、$、#、%)。每检测到一个非字母字符,Special变量就增加1 ,

                         //最后得到输入的密码中总共有几个非字母字符

                           if((DBPassword[i]== "!")||(DBPassword[i]== "$")||(DBPassword[i]==

                           "#")||(DBPassword[i]== "%"))then    
                                Special=Special+1;
                             
                            endif; 
                       
                          //统计输入的密码是否包含四类字符中的三类字符

                        // 如果数字,大写字母,小写字母,非字母字符的变量都大于0 ,那么就往类型time变量就加1

                            times = 0;
                            if (Nmuber > 0)then
                               times = times + 1;
                            endif;
                            if (Uppercase > 0)then
                               times = times + 1; 
                              
                            endif;
                            if (Lowcase > 0) then
                               times = times + 1; 
                              
                             endif;
                            if (Special > 0) then
                               times = times + 1; 
                             endif;

                           //如果类型<3 并且目前正在检测的字符已经是输入密码的最后一个字符,就提示密码复杂度

                           //不够

                            if ((times <3) && (i == iLength-1))then
                               MessageBox(@ResetPW,INFORMATION);
                               goto Dlg_EnterPassword; 
                            endif;
                            

                             //如果类型>=3,表示输入的密码符合 包含四类字符中的三类字符,就退出循环体

     
                            if (times >= 3)then
                              i = iLength;
                             endif; 
                       endfor; 
        endif;

    版权声明:转载请以链接形式注明原始出处。

  • 相关阅读:
    Docker Dockerfile 定制镜像
    Nginx之URL重写(rewrite)配置
    Jenkins可用环境变量列表以及环境变量的使用(Shell/Command/Maven/Ant)
    vue实现element-ui对话框可拖拽功能
    配置了ssh免密登录还是提示权限不足怎么解决
    一篇文章彻底搞懂base64编码原理
    想不到吧
    async_retrying
    aiojobs
    python字典不区分大小写
  • 原文地址:https://www.cnblogs.com/sabrinahuang/p/2044464.html
Copyright © 2020-2023  润新知