summaryrefslogtreecommitdiffstats
path: root/app/controllers/my_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-15 14:31:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-15 14:31:54 +0000
commit28f0c4f131b02ab67bd9c254f9853168ec6a5b65 (patch)
treefeedcef78913a173d5f8776c3f13e0f8990c317b /app/controllers/my_controller.rb
parent638583012ae165e5cb197fb3b4d7a0fe54318217 (diff)
downloadredmine-28f0c4f131b02ab67bd9c254f9853168ec6a5b65.tar.gz
redmine-28f0c4f131b02ab67bd9c254f9853168ec6a5b65.zip
Adds the ability for users to delete their own account (#10664). Can be disabled in application settings.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9417 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/my_controller.rb')
-rw-r--r--app/controllers/my_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index cdf0182de..b3c975b78 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -65,6 +65,24 @@ class MyController < ApplicationController
end
end
+ # Destroys user's account
+ def destroy
+ @user = User.current
+ unless @user.own_account_deletable?
+ redirect_to :action => 'account'
+ return
+ end
+
+ if request.post? && params[:confirm]
+ @user.destroy
+ if @user.destroyed?
+ logout_user
+ flash[:notice] = l(:notice_account_deleted)
+ end
+ redirect_to home_path
+ end
+ end
+
# Manage user's password
def password
@user = User.current