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
@ -18,6 +18,7 @@
|
||||
|
||||
class SessionsController < ApplicationController
|
||||
include Registrar
|
||||
include Emailer
|
||||
|
||||
skip_before_action :verify_authenticity_token, only: [:omniauth, :fail]
|
||||
|
||||
@ -58,9 +59,16 @@ class SessionsController < ApplicationController
|
||||
# Add pending role if approval method and is a new user
|
||||
if approval_registration && !@user_exists
|
||||
user.add_role :pending
|
||||
|
||||
# Inform admins that a user signed up if emails are turned on
|
||||
send_approval_user_signup_email(user) if Rails.configuration.enable_email_verification
|
||||
|
||||
return redirect_to root_path, flash: { success: I18n.t("registration.approval.signup") }
|
||||
end
|
||||
|
||||
send_invite_user_signup_email(user) if Rails.configuration.enable_email_verification &&
|
||||
invite_registration && !@user_exists
|
||||
|
||||
login(user)
|
||||
rescue => e
|
||||
logger.error "Error authenticating via omniauth: #{e}"
|
||||
|
Reference in New Issue
Block a user