我刚刚阅读了 meteor 的帐户配置选项,“restrictCreationByEmailDomain”选项很棒
Accounts.config({ restrictCreationByEmailDomain: 'school.edu' })
我想知道我能否使用以逗号或数组分隔的域列表来代替“school.edu” 有 meteor 账户系统的简单教程吗? 请帮忙
最佳答案
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);
},
...
});
关于javascript - meteor 的 restrictCreationByEmailDomain 选项如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19871790/