mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 12:34:12 +00:00
Confirmation Emails: Add way to resend (#287)
* Add way to resend confirmation email. * Resend confirmation email if user sets it to the same as pending * I10n: No pending email change
This commit is contained in:
@@ -45,7 +45,6 @@ class User < ApplicationRecord
|
||||
|
||||
def initiate_email_change(new_email)
|
||||
return false if new_email == email
|
||||
return false if new_email == unconfirmed_email
|
||||
|
||||
if Rails.application.config.app_mode.self_hosted? && !Setting.require_email_confirmation
|
||||
update(email: new_email)
|
||||
@@ -59,6 +58,15 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def resend_confirmation_email
|
||||
if pending_email_change?
|
||||
EmailConfirmationMailer.with(user: self).confirmation_email.deliver_later
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def request_impersonation_for(user_id)
|
||||
impersonated = User.find(user_id)
|
||||
impersonator_support_sessions.create!(impersonated: impersonated)
|
||||
|
||||
Reference in New Issue
Block a user