Add "Reset account" followed by sample data preload (#163)

* Add reset with sample data option on profile settings

* No need for "member" user in preload

* Cleanup/shorten copy
This commit is contained in:
Juan José Mata
2025-09-25 11:43:23 +02:00
committed by GitHub
parent 3264a96249
commit dfd467ccb5
12 changed files with 138 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
class UsersController < ApplicationController
before_action :set_user
before_action :ensure_admin, only: :reset
before_action :ensure_admin, only: %i[reset reset_with_sample_data]
def update
@user = Current.user
@@ -40,6 +40,11 @@ class UsersController < ApplicationController
redirect_to settings_profile_path, notice: t(".success")
end
def reset_with_sample_data
FamilyResetJob.perform_later(Current.family, load_sample_data_for_email: @user.email)
redirect_to settings_profile_path, notice: t(".success")
end
def destroy
if @user.deactivate
Current.session.destroy