Spaces:
Sleeping
Sleeping
File size: 591 Bytes
bd7635f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import bcrypt
class User:
def __init__(self, email, password, profile):
self.email = email
self.password_hash = self._hash_password(password)
self.password = password
self.profile = profile
def _hash_password(self, password):
hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt())
return hashed_password
def check_password(self, password):
entered_password = password.encode('utf-8')
stored_pwd = self.password.encode('utf-8')
return bcrypt.checkpw(entered_password, stored_pwd)
|