Skip to content
Snippets Groups Projects
Commit 95ecd8fd authored by pabois's avatar pabois
Browse files

code climate

parent 11db842f
No related branches found
No related tags found
No related merge requests found
......@@ -9,8 +9,7 @@ module User::WithRegistrationContext
private
def extranet_access
unless (registration_context.has_feature?(:alumni) && registration_context.alumni.where(email: email).any?) ||
(registration_context.has_feature?(:contacts) && registration_context.connected_persons.where(email: email).any?)
unless user_can_access_registration_context?
if registration_context.registration_contact.present?
errors.add :email, I18n.t('extranet.errors.email_not_allowed_with_contact', contact: registration_context.registration_contact)
else
......@@ -19,5 +18,10 @@ module User::WithRegistrationContext
end
end
def user_can_access_registration_context?
(registration_context.has_feature?(:alumni) && registration_context.alumni.where(email: email).any?) ||
(registration_context.has_feature?(:contacts) && registration_context.connected_persons.where(email: email).any?)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment