Skip to content

Instantly share code, notes, and snippets.

@ctaloi
Created September 3, 2015 13:59
Show Gist options
  • Save ctaloi/2c3371cde98c0a5907ed to your computer and use it in GitHub Desktop.
Save ctaloi/2c3371cde98c0a5907ed to your computer and use it in GitHub Desktop.
Validate a new Meteor account based on email suffix
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