From e03d90882e7a0bbf2b27970f6ed24b4d574b0c79 Mon Sep 17 00:00:00 2001 From: Shamil K Muhammed <noteness@disroot.org> Date: Fri, 5 Jan 2018 15:31:22 +0530 Subject: [PATCH] Use unicode for encrypted_pass Check password fails when a non-ascii character is in the password. Fixed that --- diaspora_auth_provider.py | 6 +++--- requirements.txt | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/diaspora_auth_provider.py b/diaspora_auth_provider.py index 143b2e5..ab72fe7 100644 --- a/diaspora_auth_provider.py +++ b/diaspora_auth_provider.py @@ -22,13 +22,13 @@ import bcrypt import logging -__VERSION__ = "0.0.6" +__VERSION__ = "0.0.7" logger = logging.getLogger(__name__) class DiasporaAuthProvider: - __version__ = "0.0.6" + __version__ = "0.0.7" def __init__(self, config, account_handler): self.account_handler = account_handler @@ -74,7 +74,7 @@ class DiasporaAuthProvider: logger.debug("User {} exists. Checking password".format(local_part)) # user exists, check if the password is correct. 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')) == encrypted_password.encode('utf8')): logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part)) diff --git a/requirements.txt b/requirements.txt index e122103..2e83921 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ psycopg2 bcrypt -Twisted>=15.1.0 \ No newline at end of file +pymysql +Twisted>=15.1.0 -- GitLab