commit/galaxy-central: dan: Minor tweeks for redirect flow during OpenID process.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/f6e790d94282/ changeset: f6e790d94282 user: dan date: 2012-04-13 15:57:08 summary: Minor tweeks for redirect flow during OpenID process. affected #: 1 file diff -r a30f98b4b463f32a133f7a42d36411f0f9e63658 -r f6e790d9428273e2775b3e428c1fdd5f946a0ca3 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py +++ b/lib/galaxy/web/controllers/user.py @@ -60,8 +60,6 @@ auto_associate = util.string_as_bool( kwd.get( 'auto_associate', False ) ) use_panels = util.string_as_bool( kwd.get( 'use_panels', False ) ) action = 'login' - if not redirect: - redirect = url_for( '/' ) consumer = trans.app.openid_manager.get_consumer( trans ) if openid_url: openid_provider_obj = trans.app.openid_providers.new_provider_from_identifier( openid_url ) @@ -113,7 +111,7 @@ consumer = trans.app.openid_manager.get_consumer( trans ) info = consumer.complete( kwd, trans.request.url ) display_identifier = info.getDisplayIdentifier() - redirect = kwd.get( 'redirect', url_for( '/' ) ) + redirect = kwd.get( 'redirect', '' ) openid_provider = kwd.get( 'openid_provider', None ) if info.status == trans.app.openid_manager.FAILURE and display_identifier: message = "Login via OpenID failed. The technical reason for this follows, please include this message in your email if you need to %s to resolve this problem: %s" % ( contact, info.message ) @@ -163,6 +161,8 @@ openid_provider_obj.post_authentication( trans, trans.app.openid_manager, info ) if redirect: message = '%s<br>Click <a href="%s"><strong>here</strong></a> to return to the page you were previously viewing.' % ( message, redirect ) + if redirect and status != "error": + return trans.response.send_redirect( redirect ) return trans.response.send_redirect( url_for( controller='user', action='openid_manage', use_panels=True, @@ -173,6 +173,8 @@ trans.handle_user_login( user_openid.user, webapp ) trans.log_event( "User logged in via OpenID: %s" % display_identifier ) openid_provider_obj.post_authentication( trans, trans.app.openid_manager, info ) + if not redirect: + redirect = url_for( '/' ) return trans.response.send_redirect( redirect ) trans.sa_session.add( user_openid ) trans.sa_session.flush() @@ -252,14 +254,19 @@ message = '%s<li><a href="%s" target="_blank">%s</a></li>' % ( message, url_for( controller='user', action='openid_auth', openid_provider=openid.id, redirect=redirect, auto_associate=True ), openid.name ) message = "%s</ul>" % ( message ) return trans.response.send_redirect( url_for( controller='user', - action='openid_manage', - use_panels=True, - redirect=redirect, - message=message, - status='info' ) ) - if not redirect: - redirect = url_for( '/' ) - return trans.response.send_redirect( redirect ) + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) + if redirect: + return trans.response.send_redirect( redirect ) + return trans.response.send_redirect( url_for( controller='user', + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) if kwd.get( 'create_user_button', False ): password = kwd.get( 'password', '' ) confirm = kwd.get( 'confirm', '' ) @@ -304,9 +311,14 @@ redirect=redirect, message=message, status='info' ) ) - if not redirect: - redirect = url_for( '/' ) - return trans.response.send_redirect( redirect ) + if redirect: + return trans.response.send_redirect( redirect ) + return trans.response.send_redirect( url_for( controller='user', + action='openid_manage', + use_panels=use_panels, + redirect=redirect, + message=message, + status='info' ) ) else: message = error status = 'error' Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket