diff --git a/ckan/lib/base.py b/ckan/lib/base.py index 52604d48e7f..8f4d8a377fd 100644 --- a/ckan/lib/base.py +++ b/ckan/lib/base.py @@ -195,12 +195,17 @@ def _identify_user(self): c.userobj = model.User.by_name(c.user) if c.userobj is None: # This occurs when you are logged in, clean db - # and then restart i.e. only really for testers. There is no - # user object, so even though repoze thinks you are logged in - # and your cookie has ckan_display_name, we need to force user - # to logout and login again to get the User object. - c.user = None - self.log.warn('Logout to login') + # and then restart (or when you change your username) + # There is no user object, so even though repoze thinks you + # are logged in and your cookie has ckan_display_name, we + # need to force user to logout and login again to get the + # User object. + session['lang'] = request.environ.get('CKAN_LANG') + session.save() + + pth = getattr(request.environ['repoze.who.plugins']\ + ['friendlyform'], 'logout_handler_path') + h.redirect_to(pth) else: c.userobj = self._get_user_for_apikey() if c.userobj is not None: diff --git a/ckan/templates/user/edit_user_form.html b/ckan/templates/user/edit_user_form.html index 2644a3e7608..7a297d072d6 100644 --- a/ckan/templates/user/edit_user_form.html +++ b/ckan/templates/user/edit_user_form.html @@ -1,6 +1,6 @@ -
Errors in form
+

Changing your username will log you out, and require you to log back in with the new username