2024-05-26 10:45:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-04-14 19:01:32 +00:00
|
|
|
class UserMailer < ApplicationMailer
|
|
|
|
helper(:mailer)
|
|
|
|
|
|
|
|
def email_verification
|
|
|
|
@user = params[:user]
|
|
|
|
@token = params[:token]
|
|
|
|
|
2024-06-03 10:54:38 +00:00
|
|
|
mail(to: @user.email, subject: t(".email_verification.subject"))
|
2024-04-14 19:01:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def email_verified
|
|
|
|
@user = params[:user]
|
|
|
|
|
2024-06-03 10:54:38 +00:00
|
|
|
mail(to: @user.email, subject: t(".email_verified.subject"))
|
|
|
|
end
|
|
|
|
|
|
|
|
def password_reset
|
|
|
|
@user = params[:user]
|
|
|
|
@token = params[:token]
|
|
|
|
|
2024-06-05 13:34:22 +00:00
|
|
|
return if @user.password_reset_last_sent_at&.after?(10.minutes.ago)
|
|
|
|
|
|
|
|
@user.update(password_reset_last_sent_at: Time.zone.now)
|
2024-06-03 10:54:38 +00:00
|
|
|
mail(to: @user.email, subject: t(".password_reset.subject"))
|
2024-04-14 19:01:32 +00:00
|
|
|
end
|
|
|
|
end
|