-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added validator for email address to only permit Andelans
- Loading branch information
Oreoluwa Akinniranye
committed
Feb 3, 2016
1 parent
d39b544
commit b699687
Showing
3 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module AndelaValidator | ||
extend ActiveSupport::Concern | ||
|
||
ANDELA_EMAIL_REGEX = /@andela.co[m]?\z/ | ||
ANDELA_EMAIL_REGEX = /[\w.]+@andela.co[m]?\z/ | ||
included do | ||
validates :email, presence: true, format: {with: ANDELA_EMAIL_REGEX} | ||
validates :email, presence: true, format: {with: ANDELA_EMAIL_REGEX, message: "Sign in with an Andela email address"} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters