Skip to content

Commit

Permalink
use standard devise fail message i18n key
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Nov 17, 2024
1 parent b28fbba commit e50eaa2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/lib/warden/barcode_auth_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def authenticate!
if local_user_by_univ_id && local_user_by_username && local_user_by_univ_id.id != local_user_by_username.id
Rails.logger.debug "Found 2 conflicting user records in db. ID: #{local_user_by_univ_id.id } and #{local_user_by_username.id }."
Rails.logger.debug "fail BarcodeAuthStrategy.authenticate #{user_id}"
fail!('Invalid user account.')
fail!(:invalid)
return validate(resource) { false }
end

Expand Down
7 changes: 4 additions & 3 deletions app/lib/warden/ppy_auth_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def authenticate!
alma_user = Warden::PpyAuthStrategy.find_alma_user_matching_py_cyin(request)

if alma_user.nil?
fail!("User not found in Alma")
fail!(:invalid)
return validate(resource) { false }
end

Expand All @@ -27,7 +27,7 @@ def authenticate!
if local_user_by_univ_id && local_user_by_username && local_user_by_univ_id.id != local_user_by_username.id
Rails.logger.debug "Found 2 conflicting user records in db. ID: #{local_user_by_univ_id.id } and #{local_user_by_username.id }."
Rails.logger.debug "fail PpyAuthStrategy.authenticate #{user_id}"
fail!('Invalid user account.')
fail!(:invalid)
return validate(resource) { false }
end

Expand All @@ -53,7 +53,8 @@ def authenticate!
success!(local_user)
else
Rails.logger.debug "fail PpyAuthStrategy.authenticate - No PY Headers present"
fail!("Not authenticated by Passport York")
fail!(:invalid)
return validate(resource) { false }
end
end

Expand Down

0 comments on commit e50eaa2

Please sign in to comment.