X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=conf%2Fauth%2Fmysql_login.py;h=95b3aa660c4e93fe9cb1a2aac0e24bf499ce4278;hb=f029e903020a60684cc2fb236829818d798da757;hp=274abcd76d83397287e5f532a71b6eee560b3b17;hpb=e5f40cdde2e9c100a7c1997cc5adb1bf96199483;p=matthijs%2Fprojects%2Fwipi.git diff --git a/conf/auth/mysql_login.py b/conf/auth/mysql_login.py index 274abcd..95b3aa6 100644 --- a/conf/auth/mysql_login.py +++ b/conf/auth/mysql_login.py @@ -15,9 +15,13 @@ class mysql_login(BaseAuth): logout_possible = True login_inputs = ['username', 'password'] - def __init__(self, name='mysql', dbhost=None, dbuser=None, dbpass=None, dbname=None, dbport=None, verbose=False): + def __init__(self, name='mysql', dbhost=None, dbuser=None, dbpass=None, dbname=None, dbport=None, verbose=False, hint=None): """ Authenticate using credentials from a mysql database + + The name parameter should be unique among all authentication methods. + + The hint parameter is a snippet of HTML that is displayed below the login form. """ self.verbose = verbose self.dbhost = dbhost @@ -26,6 +30,7 @@ class mysql_login(BaseAuth): self.dbname = dbname self.dbport = dbport self.name = name + self.hint = hint def check_login(self, request, username, password): """ Checks the given username password combination. Returns the @@ -113,7 +118,7 @@ class mysql_login(BaseAuth): if self.verbose: request.log("mysql_login: authenticated %s (email %s)" % (username, email)) - u = user.User(request, auth_username=username, auth_method=self.name, auth_attribs=('password', 'email', )) + u = user.User(request, auth_username=username, auth_method=self.name, auth_attribs=('name', 'password', 'email')) u.email = email #u.remember_me = 0 # 0 enforces cookie_lifetime config param u.create_or_update(True) @@ -127,4 +132,8 @@ class mysql_login(BaseAuth): request.log(''.join(traceback.format_exception(*info))) return ContinueLogin(user_obj) + def login_hint(self, request): + """ Return a snippet of HTML that is displayed with the login form. """ + return self.hint + # vim: set sw=4 expandtab sts=4:vim