[FIX] base: force comparison between strings

When using another login method than stored password (ldpa,i oauth...),
user's password is NULL in database. Passlib < 1.7 expect the encrypted
password to be a string, leading to an uncaught traceback, forbidding
login.
This commit is contained in:
Christophe Simonis
2018-08-24 10:58:18 +02:00
parent 44d92b560a
commit 3a95d2fdf8
+2 -1
View File
@@ -290,8 +290,9 @@ class Users(models.Model):
@api.model
def check_credentials(self, password):
""" Override this method to plug additional authentication methods"""
assert password
self.env.cr.execute(
'SELECT password FROM res_users WHERE id=%s',
"SELECT COALESCE(password, '') FROM res_users WHERE id=%s",
[self.env.user.id]
)
[hashed] = self.env.cr.fetchone()