Fix MysqlAuthUser when number of results != 1, typo in README
This commit is contained in:
parent
43ae81fdb3
commit
494da62935
2 changed files with 4 additions and 2 deletions
|
@ -188,7 +188,7 @@ Authentication backend
|
||||||
* dummy backend ``cas_server.auth.DummyAuthUser``: all authentication attempt fails.
|
* dummy backend ``cas_server.auth.DummyAuthUser``: all authentication attempt fails.
|
||||||
* test backend ``cas_server.auth.TestAuthUser``: username is ``test`` and password is ``test``
|
* test backend ``cas_server.auth.TestAuthUser``: username is ``test`` and password is ``test``
|
||||||
the returned attributes for the user are: ``{'nom': 'Nymous', 'prenom': 'Ano', 'email': 'anonymous@example.net'}``
|
the returned attributes for the user are: ``{'nom': 'Nymous', 'prenom': 'Ano', 'email': 'anonymous@example.net'}``
|
||||||
* django backend ``cas_server.auth.DjangoAuthUser``: Users are anthenticated agains django users system.
|
* django backend ``cas_server.auth.DjangoAuthUser``: Users are authenticated agains django users system.
|
||||||
This is the default backend. The returned attributes are the fields available on the user model.
|
This is the default backend. The returned attributes are the fields available on the user model.
|
||||||
* mysql backend ``cas_server.auth.MysqlAuthUser``: see the 'Mysql backend settings' section.
|
* mysql backend ``cas_server.auth.MysqlAuthUser``: see the 'Mysql backend settings' section.
|
||||||
The returned attributes are those return by sql query ``CAS_SQL_USER_QUERY``.
|
The returned attributes are those return by sql query ``CAS_SQL_USER_QUERY``.
|
||||||
|
|
|
@ -84,6 +84,8 @@ class MysqlAuthUser(AuthUser):
|
||||||
if curs.execute(settings.CAS_SQL_USER_QUERY, (username,)) == 1:
|
if curs.execute(settings.CAS_SQL_USER_QUERY, (username,)) == 1:
|
||||||
self.user = curs.fetchone()
|
self.user = curs.fetchone()
|
||||||
super(MysqlAuthUser, self).__init__(self.user['username'])
|
super(MysqlAuthUser, self).__init__(self.user['username'])
|
||||||
|
else:
|
||||||
|
super(MysqlAuthUser, self).__init__(username)
|
||||||
|
|
||||||
def test_password(self, password):
|
def test_password(self, password):
|
||||||
"""test `password` agains the user"""
|
"""test `password` agains the user"""
|
||||||
|
|
Loading…
Reference in a new issue