Skip to content
Snippets Groups Projects
Commit eac82900 authored by shawn-higgins1's avatar shawn-higgins1 Committed by Jesus Federico
Browse files

GRN2-148: Always check that email notifications are enabled before sending an email (#539)

* Always check that email notificatiosn are enabled before sending an email

* Fix tests

* Fix formating

* Change to hardcoding the validation
parent f88d67f6
No related branches found
No related tags found
No related merge requests found
......@@ -21,12 +21,16 @@ module Emailer
# Sends account activation email.
def send_activation_email(user)
return unless Rails.configuration.enable_email_verification
@user = user
UserMailer.verify_email(@user, user_verification_link, logo_image, user_color).deliver
end
# Sends password reset email.
def send_password_reset_email(user)
return unless Rails.configuration.enable_email_verification
@user = user
UserMailer.password_reset(@user, reset_link, logo_image, user_color).deliver_now
end
......@@ -41,11 +45,15 @@ module Emailer
# Sends inivitation to join
def send_invitation_email(name, email, token)
return unless Rails.configuration.enable_email_verification
@token = token
UserMailer.invite_email(name, email, invitation_link, logo_image, user_color).deliver_now
end
def send_user_approved_email(user)
return unless Rails.configuration.enable_email_verification
UserMailer.approve_user(user, root_url, logo_image, user_color).deliver_now
end
......
......@@ -26,6 +26,10 @@ describe AdminsController, type: :controller do
end
describe "User Roles" do
before do
allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
end
context "GET #index" do
it "renders a 404 if a user tries to acccess it" do
@request.session[:user_id] = @user.id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment