emails: fix sending emails to invalid addresses.
Fix mailers to not attempt deliveries to invalid or nonexistent email addresses. This usually happened when someone changed their email, and we tried to send a confirmation email to a nonexistent address.
This commit is contained in:
@@ -9,7 +9,7 @@ class PasswordResetsController < ApplicationController
|
||||
if @user.blank?
|
||||
flash[:notice] = "That account does not exist"
|
||||
redirect_to password_reset_path
|
||||
elsif @user.can_receive_email?(require_verification: false)
|
||||
elsif @user.can_receive_email?(require_verified_email: false)
|
||||
UserMailer.password_reset(@user).deliver_later
|
||||
UserEvent.create_from_request!(@user, :password_reset, request)
|
||||
flash[:notice] = "Password reset email sent. Check your email"
|
||||
|
||||
@@ -90,7 +90,7 @@ class UsersController < ApplicationController
|
||||
flash[:notice] = "Sign up failed: #{@user.errors.full_messages.join("; ")}"
|
||||
else
|
||||
session[:user_id] = @user.id
|
||||
UserMailer.welcome_user(@user).deliver_later if @user.can_receive_email?(require_verification: false)
|
||||
UserMailer.welcome_user(@user).deliver_later
|
||||
set_current_user
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user