i just read meteor's accounts config options, "restrictCreationByEmailDomain" option is awesome
我只是阅读meteor的帐户配置选项,“restrictCreationByEmailDomain”选项很棒
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
我想知道我可以使用逗号或数组分隔的域列表代替'school.edu'是否有任何简单的流星帐户系统教程?请帮助
1 个解决方案
#1
8
restrictCreationByEmailDomain String Or Function
restrictCreationByEmailDomain字符串或函数
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).
如果设置,则仅允许在指定域中具有电子邮件的新用户或谓词函数返回true。使用基于密码的登录和公开电子邮件地址的外部服务(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);
},
...
});
#1
8
restrictCreationByEmailDomain String Or Function
restrictCreationByEmailDomain字符串或函数
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).
如果设置,则仅允许在指定域中具有电子邮件的新用户或谓词函数返回true。使用基于密码的登录和公开电子邮件地址的外部服务(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);
},
...
});