changeset 5835:1ddf7d88c53d

fix issue with non-ascii textchas, hmac_new only takes str, not unicode
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 01 Mar 2012 00:15:41 +0100
parents f3b6bb629ca1
children 0265eec31d99
files MoinMoin/security/textcha.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/security/textcha.py	Wed Feb 22 17:36:25 2012 +0100
+++ b/MoinMoin/security/textcha.py	Thu Mar 01 00:15:41 2012 +0100
@@ -83,7 +83,8 @@
             return textchas[lang]
 
     def _compute_signature(self, question, timestamp):
-        return hmac_new(self.secret, "%s%d" % (question, timestamp)).hexdigest()
+        signature = u"%s%d" % (question, timestamp)
+        return hmac_new(self.secret, signature.encode('utf-8')).hexdigest()
 
     def _init_qa(self, question=None):
         """ Initialize the question / answer.