Spaces:
Sleeping
Sleeping
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) | |