Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how meteor's restrictCreationByEmailDomain option work?

i just read meteor's accounts config options, "restrictCreationByEmailDomain" option is awesome

Accounts.config({ restrictCreationByEmailDomain: 'school.edu' })

i want to know can i use a list of domains separated by comma or array in place of 'school.edu' is there any simple tutorial for meteor accounts system ? pls help

like image 698
linto cheeran Avatar asked Nov 09 '13 02:11

linto cheeran


People also ask

How to whitelist email Domain in salesforce?

From Setup, in the Quick Find box, enter User Management Settings , and then select User Management Settings. Turn on Email Domain Allowlist.

What is the domain of an email address?

A domain name (often simply called a domain) is an easy-to-remember name that's associated with a physical IP address on the Internet. It's the unique name that appears after the @ sign in email addresses, and after www. in web addresses.


1 Answers

restrictCreationByEmailDomain String Or Function

If set, only allow new users with an email in the specified domain or if the predicate function returns true. Works with password-based sign-in and external services that expose email addresses (Google, Facebook, GitHub).

Accounts.config({
  restrictCreationByEmailDomain: function(email) {
    var domain = email.slice(email.lastIndexOf("@")+1); // or regex
    var allowed = ["school.edu", "school.edu.br"];
    return _.contains(allowed, domain);
  },
  ...
});
like image 90
Suburbio Avatar answered Nov 15 '22 05:11

Suburbio