diff options
author | Simo Sorce <simo@redhat.com> | 2014-10-13 23:41:12 -0400 |
---|---|---|
committer | Patrick Uiterwijk <puiterwijk@redhat.com> | 2014-10-24 18:03:28 +0200 |
commit | d597f362db9012a47164369e7614fd6a2060e7e5 (patch) | |
tree | a6ba342eefbe4c2d40f077fdcdcfb853934b192d /ipsilon/login | |
parent | fe50fd3423969fca640cc35b32678bab5fd491cb (diff) | |
download | ipsilon-d597f362db9012a47164369e7614fd6a2060e7e5.tar.gz ipsilon-d597f362db9012a47164369e7614fd6a2060e7e5.tar.xz ipsilon-d597f362db9012a47164369e7614fd6a2060e7e5.zip |
Return to provider if user cancels login
When the cancel button is hit return to the provider and eventually to the
original application via return urls.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Diffstat (limited to 'ipsilon/login')
-rwxr-xr-x | ipsilon/login/common.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ipsilon/login/common.py b/ipsilon/login/common.py index cb45fd6..6cd1ca8 100755 --- a/ipsilon/login/common.py +++ b/ipsilon/login/common.py @@ -226,6 +226,8 @@ class LoginFormBase(LoginPageBase): "next_url": next_url, "username": username, "login_target": target, + "cancel_url": '%s/login/cancel?%s' % (self.basepath, + self.trans.get_GET_arg()), } context.update(kwargs) if self.trans is not None: @@ -242,6 +244,7 @@ class Login(Page): def __init__(self, *args, **kwargs): super(Login, self).__init__(*args, **kwargs) + self.cancel = Cancel(*args, **kwargs) self.first_login = None self.info = Info(self._site) @@ -279,6 +282,25 @@ class Logout(Page): return self._template('logout.html', title='Logout') +class Cancel(Page): + + def GET(self, *args, **kwargs): + + session = UserSession() + session.logout(None) + + # return to the caller if any + transdata = self.get_valid_transaction('login', **kwargs).retrieve() + if 'login_return' not in transdata: + raise cherrypy.HTTPError(401) + raise cherrypy.HTTPRedirect(transdata['login_return']) + + def root(self, *args, **kwargs): + op = getattr(self, cherrypy.request.method, self.GET) + if callable(op): + return op(*args, **kwargs) + + class LoginMgrsInstall(object): def __init__(self): |