gpt4 book ai didi

javascript - meteor 的 restrictCreationByEmailDomain 选项如何工作?

转载 作者:数据小太阳 更新时间:2023-10-29 05:12:48 24 4
gpt4 key购买 nike

我刚刚阅读了 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com