Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused authentication option #5546

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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