Local account email is now downcased to match the downcased value stored in db (#1319)

Co-authored-by: Jesus Federico <jesus@123it.ca>
This commit is contained in:
Ahmad Farhat 2020-04-16 15:21:27 -04:00 committed by GitHub
parent f4990b4523
commit 5aa1868f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -65,12 +65,12 @@ class SessionsController < ApplicationController
def create def create
logger.info "Support: #{session_params[:email]} is attempting to login." logger.info "Support: #{session_params[:email]} is attempting to login."
user = User.include_deleted.find_by(email: session_params[:email]) user = User.include_deleted.find_by(email: session_params[:email].downcase)
is_super_admin = user&.has_role? :super_admin is_super_admin = user&.has_role? :super_admin
# Scope user to domain if the user is not a super admin # Scope user to domain if the user is not a super admin
user = User.include_deleted.find_by(email: session_params[:email], provider: @user_domain) unless is_super_admin user = User.include_deleted.find_by(email: session_params[:email].downcase, provider: @user_domain) unless is_super_admin
# Check user with that email exists # Check user with that email exists
return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user return redirect_to(signin_path, alert: I18n.t("invalid_credentials")) unless user