Skip to content

Commit

Permalink
Merge pull request #1213 from alphagov/allow-apostrophe
Browse files Browse the repository at this point in the history
Permit apostrophe in email address
  • Loading branch information
brucebolt authored Nov 8, 2023
2 parents 79c060f + 7338e20 commit ba11ac8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/support/requests/requester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Requester
attr_accessor :name
attr_reader :email

VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
VALID_EMAIL_REGEX = /\A[\w+\-.']+@[a-z\d\-.]+\.[a-z]+\z/i

validates :email, presence: true

Expand Down
2 changes: 2 additions & 0 deletions spec/models/support/requests/requester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ module Requests
it { should allow_value("ab @c.com").for(:email) }
it { should allow_value("[email protected] ").for(:email) }
it { should allow_value(" [email protected]").for(:email) }
it { should allow_value("a'[email protected] ").for(:email) }
it { should_not allow_value("ab").for(:email) }

it { should allow_value("").for(:collaborator_emails) }
it { should allow_value("[email protected]").for(:collaborator_emails) }
it { should allow_value("a'[email protected]").for(:collaborator_emails) }
it { should allow_value("[email protected], [email protected]").for(:collaborator_emails) }
it { should_not allow_value("ab, [email protected]").for(:collaborator_emails) }
it { should_not allow_value("[email protected]").for(:collaborator_emails) }
Expand Down

0 comments on commit ba11ac8

Please sign in to comment.