mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 21:40:45 +08:00
增加弹窗输入OTP动态码的功能
This commit is contained in:
@@ -117,13 +117,13 @@ func checkLocalUser(name, pwd, group string) error {
|
||||
}
|
||||
// 判断otp信息
|
||||
pinCode := pwd
|
||||
if !v.DisableOtp {
|
||||
pinCode = pwd[:pl-6]
|
||||
otp := pwd[pl-6:]
|
||||
if !checkOtp(name, otp, v.OtpSecret) {
|
||||
return fmt.Errorf("%s %s", name, "动态码错误")
|
||||
}
|
||||
}
|
||||
// if !v.DisableOtp {
|
||||
// pinCode = pwd[:pl-6]
|
||||
// otp := pwd[pl-6:]
|
||||
// if !CheckOtp(name, otp, v.OtpSecret) {
|
||||
// return fmt.Errorf("%s %s", name, "动态码错误")
|
||||
// }
|
||||
// }
|
||||
|
||||
// 判断用户密码
|
||||
if pinCode != v.PinCode {
|
||||
@@ -171,7 +171,7 @@ func init() {
|
||||
}
|
||||
|
||||
// 判断令牌信息
|
||||
func checkOtp(name, otp, secret string) bool {
|
||||
func CheckOtp(name, otp, secret string) bool {
|
||||
key := fmt.Sprintf("%s:%s", name, otp)
|
||||
|
||||
userOtpMux.Lock()
|
||||
|
Reference in New Issue
Block a user