-
-
Save benstr/e05f089fbd7d2a578835 to your computer and use it in GitHub Desktop.
Validate a new Meteor account based on email suffix
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
function checkEmailAddress(emailAddress) { | |
check(emailAddress, String); | |
suffix = emailAddress.split('@')[1]; | |
if (suffix === "wcs.com") | |
{ return true } else { return false }; | |
}; | |
Accounts.validateNewUser(function (user) { | |
console.log(user); | |
if (checkEmailAddress(user.emails[0].address)) { | |
return true; | |
} else { | |
throw new Meteor.Error(403, "Email must be from the correct domain"); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment