Base_crypt: fix the login algorithm.
bzr revid: p_christ@hol.gr-20101228095210-9tynwynx8cn2pgs2
This commit is contained in:
parent
e1c5be76fe
commit
72ad853a20
|
@ -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' ),) )
|
||||
|
|
Loading…
Reference in New Issue