send confirmation

pull/402/head
Pete Matsyburka 2 weeks ago
parent d2a0937038
commit dfab4c331c

@ -10,6 +10,8 @@ class ProfileController < ApplicationController
def update_contact def update_contact
if current_user.update(contact_params) if current_user.update(contact_params)
if current_user.try(:pending_reconfirmation?) && current_user.previous_changes.key?(:unconfirmed_email) 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, redirect_to settings_profile_index_path,
notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address') notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address')
else else

@ -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.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) 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, redirect_back fallback_location: settings_users_path,
notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address') notice: I18n.t('a_confirmation_email_has_been_sent_to_the_new_email_address')
else else

@ -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
Loading…
Cancel
Save