X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d6da1499fc7c86a5bb175a1bf0bf974c36003523..f3a9d2e9d61f3f596d559ac75d54c08bc60fc629:/app/controllers/accounts_controller.rb diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 06eb031c4..db9721010 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -51,4 +51,18 @@ class AccountsController < ApplicationController redirect_to auth_url(params[:user][:auth_provider], params[:user][:auth_uid]), :status => :temporary_redirect end end + + def destroy + if current_user.deletion_allowed? + current_user.soft_destroy! + + session.delete(:user) + session_expires_automatically + + flash[:notice] = t ".success" + redirect_to root_path + else + head :bad_request + end + end end