Support for TOTP valid_window configuration (#2187)

This commit is contained in:
vkill
2018-12-17 14:26:00 +08:00
committed by 老广
parent b95f8a7d6b
commit ab6c88823d
4 changed files with 13 additions and 1 deletions

View File

@@ -292,7 +292,8 @@ def check_otp_code(otp_secret_key, otp_code):
if not otp_secret_key or not otp_code:
return False
totp = pyotp.TOTP(otp_secret_key)
return totp.verify(otp_code)
otp_valid_window = settings.OTP_VALID_WINDOW or 0
return totp.verify(otp=otp_code, valid_window=otp_valid_window)
def get_password_check_rules():