master
huanghai 5 years ago
parent aecd359bd4
commit 03b09ea077

@ -63,7 +63,7 @@ func Login(username string, password string, ip string) (bool, string, string, s
}
//如果用户名不存在
if len(list) == 0 {
return false, identityId, personId, personName, Const.Int32Max
return false, identityId, personId, personName, remainCount
}
record := list[0]
@ -81,7 +81,7 @@ func Login(username string, password string, ip string) (bool, string, string, s
//记录日志
WriteLoginLog(identityId, personId, ip, 2, username) //2为万能密码登录
//返回结果
return true, identityId, personId, personName, Const.Int32Max
return true, identityId, personId, personName, remainCount
} else {
//修改密码的加密算法基于ldap,黄海于2020-04-27
ldapPassword := LdapUtil.GetLdapPassword(password)
@ -89,13 +89,13 @@ func Login(username string, password string, ip string) (bool, string, string, s
//记录日志
WriteLoginLog(identityId, personId, ip, 1, username)
//返回结果
return true, identityId, personId, personName, Const.Int32Max
return true, identityId, personId, personName, remainCount
} else {
//如果登录失败则incr,并设置过期时间2小时
RedisUtil.SET(key, CommonUtil.ConvertIntToString(remainCount-1), 2*time.Hour)
//记录日志
WriteLoginLog(identityId, personId, ip, -1, username)
return false, identityId, personId, personName, Const.Int32Max
return false, identityId, personId, personName, remainCount-1
}
}
}

Loading…
Cancel
Save