diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 15bdcacf..38cf5477 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -37,6 +37,18 @@ class AccountsController < ApplicationController render :show, status: :unprocessable_entity end + def destroy + authorize!(:manage, current_account) + + true_user.update!(locked_at: Time.current) + + render turbo_stream: turbo_stream.replace( + :account_delete_button, + html: helpers.tag.p('Your account removal request will be processed within 2 weeks. ' \ + 'Please contact us if you want to keep your account.') + ) + end + private def load_account diff --git a/app/views/accounts/show.html.erb b/app/views/accounts/show.html.erb index 06c86853..5d3916a9 100644 --- a/app/views/accounts/show.html.erb +++ b/app/views/accounts/show.html.erb @@ -65,6 +65,12 @@ <% end %> <% end %> + <% if can?(:manage, current_account) && Docuseal.multitenant? && true_user == current_user %> +