From e273050c343802dbb9e847722afc48ff3e636184 Mon Sep 17 00:00:00 2001
From: Tres Seaver <tseaver@palladion.com>
Date: Sun, 18 Mar 2012 18:50:43 +0100
Subject: [PATCH] Enocde non-bytes before hasing.

---
 repoze/who/plugins/sql.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/repoze/who/plugins/sql.py b/repoze/who/plugins/sql.py
index 665bb74..254aa36 100644
--- a/repoze/who/plugins/sql.py
+++ b/repoze/who/plugins/sql.py
@@ -14,6 +14,8 @@
 
     if stored_password_hash.startswith('{SHA}'):
         stored_password_hash = stored_password_hash[5:]
+        if not isinstance(cleartext_password, type(b'')):
+            cleartext_password = cleartext_password.encode('utf-8')
         digest = sha1(cleartext_password).hexdigest()
     else:
         digest = cleartext_password

--
Gitblit v1.9.3