From 6097f6eed53976001ff0df7e5877d087726d6f65 Mon Sep 17 00:00:00 2001 From: Eklavya Sharma Date: Fri, 17 Jun 2016 20:33:09 +0530 Subject: [PATCH] zerver/lib/initial_password.py: Encode return value. zerver.lib.initial_password.initial_password is supposed to return an Optional[text_type], but it returns an Optional[binary_type] instead. Encode the return value to make sure it returns an Optional[text_type]. --- zerver/lib/initial_password.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/lib/initial_password.py b/zerver/lib/initial_password.py index 61b98e7fc6..829df6ad33 100644 --- a/zerver/lib/initial_password.py +++ b/zerver/lib/initial_password.py @@ -17,7 +17,7 @@ def initial_password(email): if settings.INITIAL_PASSWORD_SALT is not None: encoded_key = (settings.INITIAL_PASSWORD_SALT + email).encode("utf-8") digest = hashlib.sha256(encoded_key).digest() - return base64.b64encode(digest)[:16] + return base64.b64encode(digest)[:16].decode('utf-8') else: # None as a password for a user tells Django to set an unusable password return None