From c7d43ce5cc885aaeaed87797293cd769c8047c1f Mon Sep 17 00:00:00 2001 From: Robert Kerr Date: Sun, 18 Nov 2018 10:23:47 +0000 Subject: [PATCH] Fix for when TOTP starts with 0 PyOTP wants the token as a string, by passing it as an int leading 0s get stripped and verification fails --- app/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 8b2babc..7e87d08 100644 --- a/app/models.py +++ b/app/models.py @@ -90,7 +90,7 @@ class User(db.Model): def verify_totp(self, token): totp = pyotp.TOTP(self.otp_secret) - return totp.verify(int(token)) + return totp.verify(token) def get_hashed_password(self, plain_text_password=None): # Hash a password for the first time