diff options
author | Azul <azul@leap.se> | 2013-10-28 12:47:46 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-10-30 20:17:43 +0100 |
commit | dd88c7f84cb3c497c6327c364b3c08993c51a08f (patch) | |
tree | 84d767412c6a5af49310850ff59704c9fa15dcf9 /users/app | |
parent | 7aaedeaf6fdd2d84ebab7bde2f6a6bdcf8d930b8 (diff) |
notify user their account was successfully deleted (refs #4216)
Also fixes a cornercase when admins deleted their own account. So far they would be redirected to the users list - which then refused access. Now they'll be redirected to the home landing page as well.
Diffstat (limited to 'users/app')
-rw-r--r-- | users/app/controllers/users_controller.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index f66277d..de21983 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -48,7 +48,15 @@ class UsersController < UsersBaseController def destroy @user.destroy - redirect_to admin? ? users_url : root_url + flash[:notice] = I18n.t(:account_destroyed) + # admins can destroy other users + if @user != current_user + redirect_to users_url + else + # let's remove the invalid session + logout + redirect_to root_url + end end end |