Disallow deletion of accounts when a data export is pending

This commit is contained in:
Karina Kwiatek 2022-07-14 23:40:25 +02:00 committed by Karina Kwiatek
parent 2229b8e782
commit d9f82c4985
2 changed files with 9 additions and 0 deletions

View file

@ -8,6 +8,12 @@ class User::RegistrationsController < Devise::RegistrationsController
end
def destroy
if resource.export_processing
flash[:error] = t(".export_pending")
redirect_to edit_user_registration_path
return
end
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
resource.destroy
set_flash_message :notice, :destroyed if is_flashing_format?

View file

@ -197,3 +197,6 @@ en:
create:
info: "You have %{count} recovery codes remaining."
error: :errors.invalid_otp
registrations:
destroy:
export_pending: "You may not delete your account while account data is currently being exported."