java实现限制用户几次登录

if(logonErrNum==null||logonErrNum==0){
     u.setLogonErrNum(Long.valueOf(1));
     u.setLogonErrTime(df.format(new Date()));
    }else if(logonErrNum==errNum){
     Long logonTime=df.parse(logonErrTime).getTime();
     if(nowTime-logonTime      this.jmodel.put("msg", "你的密码输入错误超过"+errNum+"次,请隔"+maxSpacedTime+"小时后再试!");
     }else{
      u.setLogonErrTime(df.format(new Date()));
     }
    }else{
     Long logonTime=df.parse(logonErrTime).getTime();
      logonTime=df.parse(logonErrTime).getTime();
       nowTime=new Date().getTime();
     if(nowTime-logonTime      u.setLogonErrNum(logonErrNum+1);
     }else{
      u.setLogonErrTime(df.format(new Date()));
     }
    }

你可能感兴趣的:(java实现限制用户几次登录)