forked from External/greenlight
GRN2-6: Notify admins when a approve/invite user signs up (#538)
* Notify admins when a approve/invite user signs up * Fix formating * Uses admins_url variable
This commit is contained in:
committed by
Jesus Federico
parent
83a9edf81d
commit
f88d67f6fb
@ -50,6 +50,8 @@ class UsersController < ApplicationController
|
||||
flash: { success: I18n.t("registration.approval.signup") } unless Rails.configuration.enable_email_verification
|
||||
end
|
||||
|
||||
send_registration_email if Rails.configuration.enable_email_verification
|
||||
|
||||
# Sign in automatically if email verification is disabled or if user is already verified.
|
||||
login(@user) && return if !Rails.configuration.enable_email_verification || @user.email_verified
|
||||
|
||||
@ -193,6 +195,19 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def send_registration_email
|
||||
begin
|
||||
if invite_registration
|
||||
send_invite_user_signup_email(@user)
|
||||
elsif approval_registration
|
||||
send_approval_user_signup_email(@user)
|
||||
end
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
end
|
||||
end
|
||||
|
||||
# Add validation errors to model if they exist
|
||||
def valid_user_or_captcha
|
||||
valid_user = @user.valid?
|
||||
|
Reference in New Issue
Block a user