Skip to content

Commit

Permalink
handle case where no email is passed or found
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork committed Oct 18, 2024
1 parent 77bf79d commit 7c60a61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def login

# If user exists
# Else, if valid email and no user, we create an account.
if @user.errors.blank?
if @user.blank?
message = "Email #{@email} failed to authenticate on #{Date.today} via #{@kind}"
Event.log_event(Event.names[:user_authentication_failure], 'Event::Generic', 1, message)
redirect_to index_path, alert: message
elsif @user.errors.blank?
Event.log_event(Event.names[:user_authentication_successful], 'User', @user.id, "User #{@user.email} successfully authenticated on #{Date.today}", @user.id)
sign_in_and_redirect(:user, @user)
elsif @user.errors.present?
Expand Down

0 comments on commit 7c60a61

Please sign in to comment.