fix: type check error

This commit is contained in:
Gin 2018-11-06 11:24:51 +08:00
parent c21f4ea701
commit 164718bcd4
2 changed files with 8 additions and 0 deletions

View File

@ -50,6 +50,10 @@ export class HOTP extends OTP {
verify(otp, counter) {
const otp_count = this.at(counter);
if (typeof(otp) === 'number') {
otp = otp.toString();
}
if (otp === otp_count) {
return true;
}

View File

@ -75,6 +75,10 @@ export class TOTP extends OTP {
}
otp_time = super.generate_otp(Util.timecode(time, this.interval));
if (typeof(otp) === 'number') {
otp = otp.toString();
}
if (otp === otp_time) {
return true;
}