X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=blobdiff_plain;f=ipsilon%2Flogin%2Fauthfas.py;h=c688f3e41a240b8b47f92b35a7e3fca4189aee6b;hp=e4d54ef776aed0c88a012390cb135170e6be784e;hb=ccd28c8113c715ece7aa48febbe03ceccac0d733;hpb=b77995fe6c3a51257a8df1e8421217e5a71b3648 diff --git a/ipsilon/login/authfas.py b/ipsilon/login/authfas.py index e4d54ef..c688f3e 100755 --- a/ipsilon/login/authfas.py +++ b/ipsilon/login/authfas.py @@ -3,7 +3,7 @@ # Copyright (C) 2014 Ipsilon contributors, see COPYING file for license -from ipsilon.login.common import LoginPageBase, LoginManagerBase +from ipsilon.login.common import LoginFormBase, LoginManagerBase from ipsilon.login.common import FACILITY from ipsilon.util.plugin import PluginObject import cherrypy @@ -12,12 +12,7 @@ from fedora.client.fasproxy import FasProxyClient from fedora.client import AuthError -class FAS(LoginPageBase): - - def GET(self, *args, **kwargs): - context = self.create_tmpl_context() - # pylint: disable=star-args - return self._template('login/fas.html', **context) +class FAS(LoginFormBase): def POST(self, *args, **kwargs): username = kwargs.get("login_name") @@ -49,29 +44,7 @@ class FAS(LoginPageBase): error_username=not username ) # pylint: disable=star-args - return self._template('login/fas.html', **context) - - def root(self, *args, **kwargs): - op = getattr(self, cherrypy.request.method, self.GET) - if callable(op): - return op(*args, **kwargs) - - def create_tmpl_context(self, **kwargs): - next_url = None - if self.lm.next_login is not None: - next_url = self.lm.next_login.path - - context = { - "title": 'Login', - "action": '%s/login/fas' % self.basepath, - "service_name": self.lm.service_name, - "username_text": self.lm.username_text, - "password_text": self.lm.password_text, - "description": self.lm.help_text, - "next_url": next_url, - } - context.update(kwargs) - return context + return self._template(self.formtemplate, **context) class LoginManager(LoginManagerBase): @@ -80,17 +53,13 @@ class LoginManager(LoginManagerBase): super(LoginManager, self).__init__(*args, **kwargs) self.name = 'fas' self.path = 'fas' + self.service_name = 'fas' self.page = None self.fpc = None self.description = """ Form based login Manager that uses the Fedora Authentication Server """ self._options = { - 'service name': [ - """ The name of the PAM service used to authenticate. """, - 'string', - 'remote' - ], 'help text': [ """ The text shown to guide the user at login time. """, 'string', @@ -122,10 +91,9 @@ Form based login Manager that uses the Fedora Authentication Server '' ], } - - @property - def service_name(self): - return self.get_config_value('service name') + self.conf_opt_order = ['FAS url', 'FAS Proxy client user Agent', + 'FAS Insecure Auth', 'username text', + 'password text', 'help text'] @property def help_text(self): @@ -155,7 +123,7 @@ Form based login Manager that uses the Fedora Authentication Server self.fpc = FasProxyClient(base_url=self.fas_url, useragent=self.user_agent, insecure=(self.insecure == 'YES')) - self.page = FAS(site, self) + self.page = FAS(site, self, 'login/fas', 'login/fas.html') return self.page