From 69b14b9b7078a2aa67252bd3f569bd20afb5edda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 23 Sep 2009 18:42:27 +0200 Subject: [PATCH] Allow to have accent in password --- trytond/res/user.py | 2 ++ trytond/security.py | 1 + 2 files changed, 3 insertions(+) diff --git a/trytond/res/user.py b/trytond/res/user.py index 6d3b617ea6..bd38a2fdf1 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -389,6 +389,8 @@ class User(ModelSQL, ModelView): if not user_id: return 0 password += salt or '' + if isinstance(password, unicode): + password = password.encode('utf-8') if hashlib: password_sha = hashlib.sha1(password).hexdigest() else: diff --git a/trytond/security.py b/trytond/security.py index 6a0648d315..c0fb548c68 100644 --- a/trytond/security.py +++ b/trytond/security.py @@ -20,6 +20,7 @@ def login(dbname, loginname, password, cache=True): if not dbname in database_list: pool.init() user_obj = pool.get('res.user') + password = password.decode('utf-8') user_id = user_obj.get_login(cursor, 0, loginname, password) cursor.commit() cursor.close()