Skip to content

Commit

Permalink
Merge pull request #4760 from usingsky/delete_own_account
Browse files Browse the repository at this point in the history
internal server error occurs when admin deletes its own account
  • Loading branch information
wardi committed May 7, 2019
2 parents 7b958ff + bcd17ef commit 240d97e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ckan/views/user.py
Expand Up @@ -425,8 +425,12 @@ def delete(id):
except logic.NotAuthorized:
msg = _(u'Unauthorized to delete user with id "{user_id}".')
base.abort(403, msg.format(user_id=id))
user_index = h.url_for(u'user.index')
return h.redirect_to(user_index)

if g.userobj.id == id:
return logout()
else:
user_index = h.url_for(u'user.index')
return h.redirect_to(user_index)


def generate_apikey(id=None):
Expand Down

0 comments on commit 240d97e

Please sign in to comment.