summaryrefslogtreecommitdiffstats
path: root/ipsilon/login/authform.py
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-08-01 08:14:58 -0400
committerPatrick Uiterwijk <puiterwijk@redhat.com>2014-09-24 20:29:19 +0200
commita511d8ab35cc0f2872eac640ed4120766f92704a (patch)
tree9b25758ca8ad37e6f97db1138be04ae3191cc8be /ipsilon/login/authform.py
parent32bb6d8b38b9147143074710ba2dcb7f45cd4157 (diff)
downloadipsilon-a511d8ab35cc0f2872eac640ed4120766f92704a.tar.gz
ipsilon-a511d8ab35cc0f2872eac640ed4120766f92704a.tar.xz
ipsilon-a511d8ab35cc0f2872eac640ed4120766f92704a.zip
Create common form handler page
Reduce duplication Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/login/authform.py')
-rwxr-xr-xipsilon/login/authform.py33
1 files changed, 3 insertions, 30 deletions
diff --git a/ipsilon/login/authform.py b/ipsilon/login/authform.py
index 9e8e56c..c59e722 100755
--- a/ipsilon/login/authform.py
+++ b/ipsilon/login/authform.py
@@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-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
from ipsilon.util.user import UserSession
@@ -26,12 +26,7 @@ import cherrypy
import subprocess
-class Form(LoginPageBase):
-
- def GET(self, *args, **kwargs):
- context = self.create_tmpl_context()
- # pylint: disable=star-args
- return self._template('login/form.html', **context)
+class Form(LoginFormBase):
def POST(self, *args, **kwargs):
us = UserSession()
@@ -47,28 +42,6 @@ class Form(LoginPageBase):
cherrypy.log.error("Error: %s" % error)
return self.lm.auth_failed()
- 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/form' % 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
-
class LoginManager(LoginManagerBase):
@@ -120,7 +93,7 @@ Form based login Manager. Relies on mod_intercept_form_submit plugin for
return self.get_config_value('password text')
def get_tree(self, site):
- self.page = Form(site, self)
+ self.page = Form(site, self, 'login/form')
return self.page