forked from External/greenlight
Revert "Notify admins when a approval/invite user signs up"
This reverts commit 251d85d88a
.
This commit is contained in:
@ -41,14 +41,6 @@ module Emailer
|
||||
UserMailer.approve_user(user, root_url, logo_image, user_color).deliver_now
|
||||
end
|
||||
|
||||
def send_approval_user_signup_email(user)
|
||||
UserMailer.approval_user_signup(user, root_url, logo_image, user_color, admin_emails).deliver_now
|
||||
end
|
||||
|
||||
def send_invite_user_signup_email(user)
|
||||
UserMailer.invite_user_signup(user, root_url, logo_image, user_color, admin_emails).deliver_now
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Returns the link the user needs to click to verify their account
|
||||
@ -56,17 +48,6 @@ module Emailer
|
||||
edit_account_activation_url(token: @user.activation_token, email: @user.email)
|
||||
end
|
||||
|
||||
def admin_emails
|
||||
admins = User.with_role(:admin)
|
||||
|
||||
if Rails.configuration.loadbalanced_configuration
|
||||
admins = admins.without_role(:super_admin)
|
||||
.where(provider: user_settings_provider)
|
||||
end
|
||||
|
||||
admins.collect(&:email).join(",")
|
||||
end
|
||||
|
||||
def reset_link
|
||||
edit_password_reset_url(@user.reset_token, email: @user.email)
|
||||
end
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
class SessionsController < ApplicationController
|
||||
include Registrar
|
||||
include Emailer
|
||||
|
||||
skip_before_action :verify_authenticity_token, only: [:omniauth, :fail]
|
||||
|
||||
@ -50,24 +49,18 @@ class SessionsController < ApplicationController
|
||||
begin
|
||||
@auth = request.env['omniauth.auth']
|
||||
@user_exists = check_user_exists
|
||||
|
||||
|
||||
# If using invitation registration method, make sure user is invited
|
||||
return redirect_to root_path, flash: { alert: I18n.t("registration.invite.no_invite") } unless passes_invite_reqs
|
||||
|
||||
|
||||
user = User.from_omniauth(@auth)
|
||||
|
||||
# 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}"
|
||||
|
@ -50,8 +50,6 @@ 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
|
||||
|
||||
@ -195,19 +193,6 @@ 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