Esempio n. 1
0
 def password(self, secret):
     if len(secret) < PASSWORD_MIN_LENGTH:
         raise ValueError('password must be more than {min} characters '
                          'long'.format(min=PASSWORD_MIN_LENGTH))
     # Remove any existing explicit salt (the password context salts the
     # password automatically).
     self.salt = None
     self._password = text_type(password_context.encrypt(secret))
     self.password_updated = datetime.datetime.utcnow()
Esempio n. 2
0
File: models.py Progetto: rmoorman/h
 def password(self, value):
     if len(value) < PASSWORD_MIN_LENGTH:
         raise ValueError('password must be more than {min} characters '
                          'long'.format(min=PASSWORD_MIN_LENGTH))
     # Remove any existing explicit salt (the password context salts the
     # password automatically).
     self.salt = None
     self._password = text_type(password_context.encrypt(value))
     self.password_updated = datetime.datetime.utcnow()