[odrs-web] Prevent crash when moderators have no password set



commit 9149f34dcec12de4e1e173bf67b0a3f3f2682fe7
Author: Richard Hughes <richard hughsie com>
Date:   Wed Apr 29 18:57:41 2020 +0100

    Prevent crash when moderators have no password set

 app_data/odrs/models.py | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/app_data/odrs/models.py b/app_data/odrs/models.py
index 14a7355..10662bf 100644
--- a/app_data/odrs/models.py
+++ b/app_data/odrs/models.py
@@ -361,6 +361,8 @@ class Moderator(db.Model):
         self.password_hash = generate_password_hash(password)
 
     def verify_password(self, password):
+        if not self.password_hash:
+            return False
         # on success, upgrade the old hashing function to the new secure one
         if len(self.password_hash) == 40:
             if self.password_hash != _password_hash(password):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]