Skip to content
Snippets Groups Projects
Commit 18172a13 authored by Anusha Ranganathan's avatar Anusha Ranganathan
Browse files

Made logic more readable

parent 04613f3b
No related tags found
No related merge requests found
Pipeline #7921 failed
......@@ -187,21 +187,23 @@ class User < ApplicationRecord
email = User.find_or_create_user_email(user_hash)
end
if user
if update_user
messages << "Updating user #{email}"
else
messages << "Warning: User #{email} already exists. Not updating user."
user = nil
end
elsif email.blank?
if user.present? and not update_user
messages << "Warning: User #{email} already exists. Not updating user."
return false, messages, user
end
if user.blank? and email.blank?
messages << "Error: Not creating user. User has no email, saml_id or orcid."
else
return false, messages, nil
end
if user.blank?
messages << "Creating user #{email}"
user = User.new
else
messages << "Updating user #{email}"
end
return false, messages, nil unless user.present?
# email
user.email = email
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment