Skip to content

Commit

Permalink
[#1429] Pass came_from to login handler after creating a user
Browse files Browse the repository at this point in the history
Otherwise you lose the language setting for the UI. I'm not entirely
sure but that may involve two redirects.
  • Loading branch information
amercader committed Jan 21, 2014
1 parent 3f0d11b commit 4936c7c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ckan/controllers/user.py
Expand Up @@ -220,10 +220,17 @@ def _save_new(self, context):
# Redirect to a URL picked up by repoze.who which performs the
# login
login_url = self._get_repoze_handler('login_handler_path')
h.redirect_to('%s?login=%s&password=%s' % (
login_url,
str(data_dict['name']),
quote(data_dict['password1'].encode('utf-8'))))

# We need to pass the logged in URL as came_from parameter
# otherwise we lose the language setting
came_from = h.url_for(controller='user', action='logged_in',
__ckan_no_root=True)
redirect_url = '{login_url}?login={name}&password={pwd}&came_from={came_from}'
h.redirect_to(redirect_url.format(
login_url=login_url,
name=str(data_dict['name']),
pwd=quote(data_dict['password1'].encode('utf-8')),
came_from=came_from))
else:
# #1799 User has managed to register whilst logged in - warn user
# they are not re-logged in as new user.
Expand Down

0 comments on commit 4936c7c

Please sign in to comment.