From dfab4c331cf0b2432283d45820725ac441cc00d9 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 30 Nov 2025 16:00:13 +0200 Subject: [PATCH] send confirmation --- app/controllers/profile_controller.rb | 2 ++ app/controllers/users_controller.rb | 2 ++ app/jobs/send_confirmation_instructions_job.rb | 11 +++++++++++ 3 files changed, 15 insertions(+) create mode 100644 app/jobs/send_confirmation_instructions_job.rb diff --git a/app/controllers/profile_controller.rb b/app/controllers/profile_controller.rb index 878831d5..1bbdb14a 100644 --- a/app/controllers/profile_controller.rb +++ b/app/controllers/profile_controller.rb @@ -10,6 +10,8 @@ class ProfileController < ApplicationController def update_contact if current_user.update(contact_params) if current_user.try(:pending_reconfirmation?) && current_user.previous_changes.key?(:unconfirmed_email) + SendConfirmationInstructionsJob.perform_async('user_id' => current_user.id) + redirect_to settings_profile_index_path, notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address') else diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9ab9ca68..51025dd1 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -66,6 +66,8 @@ class UsersController < ApplicationController if @user.update(attrs.except(*(current_user == @user ? %i[password otp_required_for_login role] : %i[password]))) if @user.try(:pending_reconfirmation?) && @user.previous_changes.key?(:unconfirmed_email) + SendConfirmationInstructionsJob.perform_async('user_id' => @user.id) + redirect_back fallback_location: settings_users_path, notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address') else diff --git a/app/jobs/send_confirmation_instructions_job.rb b/app/jobs/send_confirmation_instructions_job.rb new file mode 100644 index 00000000..7abae742 --- /dev/null +++ b/app/jobs/send_confirmation_instructions_job.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class SendConfirmationInstructionsJob + include Sidekiq::Job + + def perform(params = {}) + user = User.find(params['user_id']) + + user.send_confirmation_instructions + end +end