mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
Fix OTP time window
This commit is contained in:
parent
918eb3bb67
commit
a628358c9f
1
package-lock.json
generated
1
package-lock.json
generated
@ -13,7 +13,6 @@
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"otpauth": "9.2.4",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -43,7 +43,6 @@
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"otpauth": "9.2.4",
|
||||
"uuid": "^9.0.1"
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,12 @@ class OTPService extends BaseService {
|
||||
secret,
|
||||
});
|
||||
|
||||
const ok = totp.validate({ token: code });
|
||||
return ok;
|
||||
const allowed = [-1, 0, 1];
|
||||
|
||||
const delta = totp.validate({ token: code });
|
||||
if ( delta === null ) return false;
|
||||
if ( ! allowed.includes(delta) ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
gen_otp_secret_ () {
|
||||
|
Loading…
Reference in New Issue
Block a user