summaryrefslogtreecommitdiff
path: root/addons/base_crypt/crypt.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-12-28 11:52:10 +0200
committerP. Christeas <p_christ@hol.gr>2010-12-28 11:52:10 +0200
commit72ad853a208dccfdbe3ce398196a6ff87507db8d (patch)
tree64a8ed207c7986387bddf97cbde257347408759c /addons/base_crypt/crypt.py
parente1c5be76fef198bd2710e6acf78e2ece8c0c21d8 (diff)
Base_crypt: fix the login algorithm.
bzr revid: p_christ@hol.gr-20101228095210-9tynwynx8cn2pgs2
Diffstat (limited to 'addons/base_crypt/crypt.py')
-rwxr-xr-xaddons/base_crypt/crypt.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py
index a8c80aa1b2c..c71d0216794 100755
--- a/addons/base_crypt/crypt.py
+++ b/addons/base_crypt/crypt.py
@@ -140,8 +140,18 @@ class users(osv.osv):
_inherit="res.users"
def login(self, db, login, password):
- if not password:
- return False
+ try:
+ return self._login(db, login, password)
+ except Exception, e:
+ import logging
+ logging.getLogger('netsvc').exception('Could not authenticate')
+ return Exception('Access Denied')
+
+ def _login(self, db, login, password):
+ if not password:
+ return False
+ if db is False:
+ raise RuntimeError("Cannot authenticate to False db!")
cr = pooler.get_db(db).cursor()
cr.execute( 'SELECT password FROM res_users WHERE login=%s', (login.encode( 'utf-8' ),) )