From 348b94da689d90993c705d1ef4e52a01b605455a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Matos?= Date: Wed, 8 May 2019 20:17:53 +0100 Subject: [PATCH] Correction for mOTP code on Python 3. --- sources/29-web2py-english/09.markmin | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/29-web2py-english/09.markmin b/sources/29-web2py-english/09.markmin index 5598afdf..a56531b6 100644 --- a/sources/29-web2py-english/09.markmin +++ b/sources/29-web2py-english/09.markmin @@ -922,6 +922,8 @@ def verify_otp(user, otp): for t in range(time_start - 1, time_end + 1): to_hash = str(t) + user.motp_secret + user.motp_pin hash = md5(to_hash).hexdigest()[:6] + # Comment the previous line and uncomment the next line if using Python 3. + # hash = md5(to_hash.encode(encoding='utf8')).hexdigest()[:6] if otp == hash: return hash