ソースを参照

small refactors

Guénaël Muller 6 年 前
コミット
3c0a898da9
共有2 個のファイルを変更した4 個の追加2 個の削除を含む
  1. 2 2
      backend/tracim_backend/lib/core/user.py
  2. 2 0
      backend/tracim_backend/models/context_models.py

+ 2 - 2
backend/tracim_backend/lib/core/user.py ファイルの表示

@@ -272,7 +272,7 @@ class UserApi(object):
272 272
         )
273 273
         return user
274 274
 
275
-    def _check_email(self, email) -> bool:
275
+    def _check_email(self, email: str) -> bool:
276 276
         """
277 277
         Check if email is completely ok to be used in user db table
278 278
         """
@@ -291,7 +291,7 @@ class UserApi(object):
291 291
         """
292 292
         Verify if given email does not already exist in db
293 293
         """
294
-        return self._session.query(User.email).filter(User.email==email).all() != []  # nopep8
294
+        return self._session.query(User.email).filter(User.email==email).count() != 0  # nopep8
295 295
 
296 296
     def _check_email_correctness(self, email: str) -> bool:
297 297
         """

+ 2 - 0
backend/tracim_backend/models/context_models.py ファイルの表示

@@ -108,6 +108,8 @@ class UserCreation(object):
108 108
             email_notification: bool = True,
109 109
     ) -> None:
110 110
         self.email = email
111
+        # INFO - G.M - 2018-08-16 - cleartext password, default value
112
+        # is auto-generated.
111 113
         self.password = password or password_generator()
112 114
         self.public_name = public_name or None
113 115
         self.timezone = timezone or ''