Skip to content

Commit

Permalink
Merge pull request #5546 from dodona-edu/chore/remove-no-auth-id-login
Browse files Browse the repository at this point in the history
Remove unused authentication option
  • Loading branch information
jorg-vr authored May 28, 2024
2 parents 984ef33 + 96d3ffd commit f874224
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
14 changes: 4 additions & 10 deletions app/controllers/auth/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,11 @@ def try_login!
# Ensure that an appropriate provider is used.
return redirect_to_preferred_provider! if provider.redirect?

identity = nil
# ensure that an auth uid is present
return redirect_with_flash!(I18n.t('devise.failure.no_auth_id')) if auth_uid.blank?

# First try to find an existing identity
if auth_uid.present?
# Basic case
identity = find_identity_by_uid
else
# For providers without auth uid
user = find_user_in_institution
identity = find_identity_by_user(user) if user.present?
Event.create(event_type: :no_auth_id_sign_in, user: user, message: "User #{user.id} logged in without auth_id using identity #{identity.id}") if identity.present? && user.present?
end
identity = find_identity_by_uid
# At this point identity should have a value if it exists in our database

if identity.blank?
Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#

class Event < ApplicationRecord
enum event_type: { rejudge: 0, permission_change: 1, exercise_repository: 2, error: 3, no_auth_id_sign_in: 4 }
enum event_type: { rejudge: 0, permission_change: 1, exercise_repository: 2, error: 3 }
belongs_to :user, optional: true

validates :event_type, presence: true
Expand Down
1 change: 1 addition & 0 deletions config/locales/devise.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ en:
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your email address before continuing."
smartschool_co_account: "Smartschool co-accounts are not supported by Dodona. Use a student's Smartschool account to sign in."
no_auth_id: "No authentication ID found."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
Expand Down
1 change: 1 addition & 0 deletions config/locales/devise.nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ nl:
unauthenticated: "Je moet eerst inloggen of aanmelden, voordat je verder kunt gaan."
unconfirmed: "Je moet eerst je account bevestigen, voordat je verder kunt gaan"
smartschool_co_account: "Smartschool co-accounts worden niet ondersteund door Dodona. Gebruik een leerlingaccount om aan te melden."
no_auth_id: "Geen authenticatie ID gevonden."
mailer:
confirmation_instructions:
subject: "Bevestigingsinstructies"
Expand Down

0 comments on commit f874224

Please sign in to comment.