Fix utf-8 encoding in password checks
It leads to errors on OS X Signed-off-by: Felix Kaechele <felix@kaechele.ca>
This commit is contained in:
parent
65b4dcfc5f
commit
9de902f67d
|
@ -121,11 +121,11 @@ class User(db.Model):
|
|||
# Hash a password for the first time
|
||||
# (Using bcrypt, the salt is saved into the hash itself)
|
||||
pw = plain_text_password if plain_text_password else self.plain_text_password
|
||||
return bcrypt.hashpw(pw.encode('utf-8'), bcrypt.gensalt())
|
||||
return bcrypt.hashpw(pw, bcrypt.gensalt())
|
||||
|
||||
def check_password(self, hashed_password):
|
||||
# Check hased password. Useing bcrypt, the salt is saved into the hash itself
|
||||
return bcrypt.checkpw(self.plain_text_password.encode('utf-8'), hashed_password.encode('utf-8'))
|
||||
return bcrypt.checkpw(self.plain_text_password.encode('utf-8'), hashed_password)
|
||||
|
||||
def get_user_info_by_id(self):
|
||||
user_info = User.query.get(int(self.id))
|
||||
|
|
Loading…
Reference in a new issue