Skip to content

Instantly share code, notes, and snippets.

@benstr
Forked from ctaloi/accountsValidate.js
Last active September 3, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benstr/e05f089fbd7d2a578835 to your computer and use it in GitHub Desktop.
Save benstr/e05f089fbd7d2a578835 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