Просмотр исходного кода

Make is_active depending on ACTIVATE_ACCOUNT

sh4nks 9 лет назад
Родитель
Сommit
3a52f6eff9
1 измененных файлов с 11 добавлено и 3 удалено
  1. 11 3
      flaskbb/user/models.py

+ 11 - 3
flaskbb/user/models.py

@@ -127,9 +127,17 @@ class User(db.Model, UserMixin, CRUDMixin):
     # Properties
     @property
     def is_active(self):
-        if flaskbb_config["ACTIVATE_ACCOUNT"] and self.activated is not None:
-            return True
-        return False
+        """Returns the state of the account.
+        If the ``ACTIVATE_ACCOUNT`` option has been disabled, it will always
+        return ``True``. Is the option activated, it will, depending on the
+        state of the account, either return ``True`` or ``False``.
+        """
+        if flaskbb_config["ACTIVATE_ACCOUNT"]:
+            if self.activated is not None:
+                return True
+            return False
+
+        return True
 
     @property
     def last_post(self):