Skip to content

Commit

Permalink
Optimize the regex for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
BarbaraOliveira13 committed Aug 30, 2024
1 parent 5a038ee commit 2483fff
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ class RegistrationFormOverride < Decidim::RegistrationForm

private

EMAIL_REGEX = /\A[^<>"']+@[a-zA-Z0-9\-.]+\.[a-zA-Z]{2,}/
def no_special_characters_in_email
errors.add(:email, :invalid) if email =~ /[<>'"]/
errors.add(:email, :invalid) if email =~ EMAIL_REGEX
end
end
end
Expand Down

0 comments on commit 2483fff

Please sign in to comment.