Skip to content

Commit

Permalink
Fix user redirect after login
Browse files Browse the repository at this point in the history
Make it redirect to the /logged_in page and then redirect again to
/dashboard. This is what it was already doing with legacy templates, fix
to do the same with new templates as well. This fixes a user test that
was failing.
  • Loading branch information
Sean Hammond committed Oct 17, 2012
1 parent 935a355 commit 6a7c9ce
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ckan/controllers/user.py
Expand Up @@ -115,13 +115,11 @@ def read(self, id=None):

def me(self, locale=None):
if not c.user:
h.redirect_to(locale=locale, controller='user',
action='login', id=None)
h.redirect_to(locale=locale, controller='user', action='login',
id=None)
user_ref = c.userobj.get_reference_preferred_for_uri()
if asbool(config.get('ckan.legacy_templates', 'false')):
h.redirect_to(locale=locale, controller='user',
action='dashboard', id=user_ref)
return self.read(id=c.username)
h.redirect_to(locale=locale, controller='user', action='dashboard',
id=user_ref)

def register(self, data=None, errors=None, error_summary=None):
return self.new(data, errors, error_summary)
Expand Down Expand Up @@ -315,7 +313,7 @@ def logged_in(self):
user_dict['display_name'])
if came_from:
return h.redirect_to(str(came_from))
return self.dashboard()
return self.me()
else:
err = _('Login failed. Bad username or password.')
if g.openid_enabled:
Expand Down

0 comments on commit 6a7c9ce

Please sign in to comment.