Browse Source

small refactors

Guénaël Muller 6 years ago
parent
commit
3c0a898da9

+ 2 - 2
backend/tracim_backend/lib/core/user.py View File

272
         )
272
         )
273
         return user
273
         return user
274
 
274
 
275
-    def _check_email(self, email) -> bool:
275
+    def _check_email(self, email: str) -> bool:
276
         """
276
         """
277
         Check if email is completely ok to be used in user db table
277
         Check if email is completely ok to be used in user db table
278
         """
278
         """
291
         """
291
         """
292
         Verify if given email does not already exist in db
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
     def _check_email_correctness(self, email: str) -> bool:
296
     def _check_email_correctness(self, email: str) -> bool:
297
         """
297
         """

+ 2 - 0
backend/tracim_backend/models/context_models.py View File

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