Skip to content

Commit

Permalink
Merge pull request #2576 from mmerickel/fix/unicode-password-hash
Browse files Browse the repository at this point in the history
password_hash is unicode, needs to be encoded
  • Loading branch information
mmerickel committed May 19, 2016
2 parents 86cf088 + 5b73bd4 commit dfdcf1b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def set_password(self, pw):

def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash
expected_hash = self.password_hash.encode('utf8')
actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
return expected_hash == actual_hash
return False
2 changes: 1 addition & 1 deletion docs/tutorials/wiki2/src/models/tutorial/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def set_password(self, pw):

def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash
expected_hash = self.password_hash.encode('utf8')
actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
return expected_hash == actual_hash
return False
2 changes: 1 addition & 1 deletion docs/tutorials/wiki2/src/tests/tutorial/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def set_password(self, pw):

def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash
expected_hash = self.password_hash.encode('utf8')
actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
return expected_hash == actual_hash
return False
2 changes: 1 addition & 1 deletion docs/tutorials/wiki2/src/views/tutorial/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def set_password(self, pw):

def check_password(self, pw):
if self.password_hash is not None:
expected_hash = self.password_hash
expected_hash = self.password_hash.encode('utf8')
actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash)
return expected_hash == actual_hash
return False

0 comments on commit dfdcf1b

Please sign in to comment.