Skip to content
Snippets Groups Projects
Unverified Commit e03d9088 authored by Shamil K Muhammed's avatar Shamil K Muhammed
Browse files

Use unicode for encrypted_pass

Check password fails when a non-ascii character is in the password.
Fixed that
parent 844f68d7
Branches
Tags
No related merge requests found
...@@ -22,13 +22,13 @@ import bcrypt ...@@ -22,13 +22,13 @@ import bcrypt
import logging import logging
__VERSION__ = "0.0.6" __VERSION__ = "0.0.7"
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class DiasporaAuthProvider: class DiasporaAuthProvider:
__version__ = "0.0.6" __version__ = "0.0.7"
def __init__(self, config, account_handler): def __init__(self, config, account_handler):
self.account_handler = account_handler self.account_handler = account_handler
...@@ -74,7 +74,7 @@ class DiasporaAuthProvider: ...@@ -74,7 +74,7 @@ class DiasporaAuthProvider:
logger.debug("User {} exists. Checking password".format(local_part)) logger.debug("User {} exists. Checking password".format(local_part))
# user exists, check if the password is correct. # user exists, check if the password is correct.
encrypted_password = user[1] encrypted_password = user[1]
peppered_pass = "{}{}".format(password, self.config.pepper) peppered_pass = u"{}{}".format(password, self.config.pepper)
if not (bcrypt.hashpw(peppered_pass.encode('utf8'), encrypted_password.encode('utf8')) if not (bcrypt.hashpw(peppered_pass.encode('utf8'), encrypted_password.encode('utf8'))
== encrypted_password.encode('utf8')): == encrypted_password.encode('utf8')):
logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part)) logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part))
......
psycopg2 psycopg2
bcrypt bcrypt
Twisted>=15.1.0 pymysql
\ No newline at end of file Twisted>=15.1.0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment