Base_crypt: fix the login algorithm.

bzr revid: p_christ@hol.gr-20101228095210-9tynwynx8cn2pgs2
This commit is contained in:
P. Christeas 2010-12-28 11:52:10 +02:00
parent e1c5be76fe
commit 72ad853a20
1 changed files with 12 additions and 2 deletions

View File

@ -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' ),) )