Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Add email validation
Browse files Browse the repository at this point in the history
  • Loading branch information
enen92 committed Feb 10, 2017
1 parent 285358c commit ee4c425
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
coverage
.DS_Store
8 changes: 7 additions & 1 deletion generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ module.exports = yeoman.extend({
}, {
type: 'input',
name: 'email',
message: 'Your email address? (for e.g. john.doe@gmail.com)'
message: 'Your email address? (for e.g. john.doe@gmail.com)',
validate: function (email) {
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
return 'You must enter a valid email address';
}
return true;
}
}, {
type: 'input',
name: 'website',
Expand Down

0 comments on commit ee4c425

Please sign in to comment.