Exemple #1
0
 def set_password(self, password):
     to_store = ''
     
     if password:
         salt = utils.gen_salt()
         hash = utils.gen_hash(password=password, salt=salt)
         algorithm = 'sha1'
         
         to_store = '|'.join((algorithm, hash, salt))
         
         self.password = to_store
     
     return to_store
Exemple #2
0
    def set_password(self, password):
        to_store = ''

        if password:
            salt = utils.gen_salt()
            hash = utils.gen_hash(password=password, salt=salt)
            algorithm = 'sha1'

            to_store = '|'.join((algorithm, hash, salt))

            self.password = to_store

        return to_store
Exemple #3
0
    def authenticate(self, email, password):
        success = False
        
        if email and password:
            try:
                (algorithm, stored_hash, salt) = self.password.split('|')

                new_hash = utils.gen_hash(password=password, salt=salt)
                
                if stored_hash == new_hash:
                    success = True
            
            except Exception:
                pass
        
        return success
Exemple #4
0
    def authenticate(self, email, password):
        success = False

        if email and password:
            try:
                (algorithm, stored_hash, salt) = self.password.split('|')

                new_hash = utils.gen_hash(password=password, salt=salt)

                if stored_hash == new_hash:
                    success = True

            except Exception:
                pass

        return success