Skip to content

Commit

Permalink
Merge pull request #95 from DMPbelgium/fix_issue_94
Browse files Browse the repository at this point in the history
fix issue 94 (error message when orcid email is not visible is too generic)
  • Loading branch information
StCyr authored Mar 4, 2024
2 parents d75e434 + 2021ca4 commit 8d0679b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions config/initializers/ugent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ def handle_orcid(scheme)
end

# User is not logged in
email = auth["info"]["email"].downcase
email = auth["info"].try("email").downcase

# Match orcid with one of more users
selectable_users = Identifier.where(identifiable_type: "User", identifier_scheme_id: scheme.id, value: full_uid)
Expand Down Expand Up @@ -1327,8 +1327,8 @@ def handle_orcid(scheme)
if user

# set firstname and surname when not present yet
user.firstname = auth["info"]["first_name"] if user.firstname.blank? || user.firstname == User.nemo
user.surname = auth["info"]["last_name"] if user.surname.blank? || user.surname == User.nemo
user.firstname = auth["info"].try("first_name") if user.firstname.blank? || user.firstname == User.nemo
user.surname = auth["info"].try("last_name") if user.surname.blank? || user.surname == User.nemo

# Match on primary email: OK
# this user's orcid must be empty or different
Expand Down Expand Up @@ -1366,8 +1366,8 @@ def handle_orcid(scheme)

user = User.new(
email: email,
firstname: auth["info"]["first_name"],
surname: auth["info"]["last_name"]
firstname: auth["info"].try("first_name"),
surname: auth["info"].try("last_name")
)

unless user.save
Expand Down

0 comments on commit 8d0679b

Please sign in to comment.