# 注册白名单与黑名单的交互

**URL:** <https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902>\
**Category:** Feature\
**Created:** [2020年三月20日 02:15 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902 "2020-03-20T02:15:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChristopherMcEwan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christophermcewan/32/41465_2.png) [@ChristopherMcEwan](https://meta.discourse.org/u/ChristopherMcEwan)\
**Post date:** [2020年三月20日 02:15 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/1 "2020-03-20T02:15:44Z")

</div>

Discourse 提供了注册白名单和黑名单功能，但这两者的交互方式还有改进空间。

当前情况如下：

- 如果仅提供白名单，则只接受来自这些域名的注册者，其他所有注册者都会被拒绝。
- 如果仅提供黑名单，则所有注册请求都会被接受，除非注册者来自黑名单中的域名。
- 如果同时提供了黑名单和白名单，则仅适用“白名单规则”，黑名单不生效。

我希望通过一个简单的代码调整，让白名单和黑名单规则按顺序应用，从而形成一个额外的“灰色”注册者群体（即既不在白名单也不在黑名单中的注册者），对这些用户可采取不同的处理方式，例如人工审核以决定是否接受或拒绝。

在我使用的场景中，这一改进将非常有价值：已知良好的域名（我社区独有的）、已知不良的域名（其他社区也常见的），以及一小部分可能良好但需要进一步分析的注册者。

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [2020年三月20日 02:40 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/2 "2020-03-20T02:40:10Z")

</div>

所以你的意思是，当启用“必须批准用户”时，白名单应绕过账户审批流程，以照顾灰色地带的情况？

---

<div class="post-metadata">

**Author:** ![ChristopherMcEwan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christophermcewan/32/41465_2.png) [@ChristopherMcEwan](https://meta.discourse.org/u/ChristopherMcEwan)\
**Post date:** [2020年三月20日 02:51 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/3 "2020-03-20T02:51:50Z")

</div>

是的，

白名单直接通过。其余的需提交审批，除非它们被列入黑名单，这种情况下应予以拒绝。

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2020年三月20日 04:07 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/4 "2020-03-20T04:07:47Z")

</div>

请注意，如果您的列表中有 35,000 条条目（根据您的回复？），那么无论如何这些方法都将无法生效。

---

<div class="post-metadata">

**Author:** ![ChristopherMcEwan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christophermcewan/32/41465_2.png) [@ChristopherMcEwan](https://meta.discourse.org/u/ChristopherMcEwan)\
**Post date:** [2020年三月20日 04:13 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/5 "2020-03-20T04:13:39Z")

</div>

好的。是否限制白名单数量？35,000 是指可能成为我们社区成员候选的组织数量。我们的初衷是允许来自这些组织的成员无需进一步资格认证或审批即可注册。

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [2020年三月20日 04:18 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/6 "2020-03-20T04:18:38Z")

</div>

考虑采用某种身份管理（IdM）方案来处理单点登录（SSO）并代为执行此操作，可能是明智之举。一旦达到该规模，将身份管理和登录功能独立出来几乎总是值得的。

---

<div class="post-metadata">

**Author:** ![ChristopherMcEwan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/christophermcewan/32/41465_2.png) [@ChristopherMcEwan](https://meta.discourse.org/u/ChristopherMcEwan)\
**Post date:** [2020年三月21日 23:04 UTC](https://meta.discourse.org/t/interaction-of-registration-whitelist-and-blacklist/144902/8 "2020-03-21T23:04:49Z")

</div>

> [@codinghorror](#):
>
> 请注意，如果您的列表中有 35,000 个条目（根据您之前的回复？），那么上述方法无论如何都无法生效。

我们将仅采用白名单模式。请问建议的域名数量上限是多少？如果更换不同的托管计划，这一限制是否会变化？

此外，我们希望在用户尝试使用非白名单域名注册时更改错误提示信息；该提示是否可配置？
