功能:使用 Google OAuth2/SSO 时,从电子邮件的用户部分创建默认用户名

I hope it’s ok to post random feature requests/suggestions here.

I have a Discourse instance set up so that users can authenticate with a Google Apps Hosted Domain (in my case @vt.edu). I have observed that Discourse assigns user names based on combining first + last name it obtains via OAuth2 - e.g., First_Last.

What I’d much prefer is if the proposed username matched the user portion of the email account user@vt.edu since user is an identifier used elsewhere whereas First_Last is not. Moreover, First_Last is not guaranteed to be unique (John_Smith) whereas the user id is. This would for my use case help with the data explorer plugin when I need to match statistics against other records and just provide an overall more uniform experience.

1 个赞

我认为 @andrei 完全删除了它,因为在“自动”根据电子邮件创建用户名时存在隐私问题?

1 个赞

不完全是。我们不是移除这个功能,而是禁用它,但可以通过 use_email_for_username_and_name_suggestions 站点设置重新启用它。

另外请注意,此更改是针对 DiscourseConnect 进行的,而不是针对其他身份验证方法(包括通过 Google 进行身份验证)。但针对其他方法的修复即将推出。

此外,在生成用户名时,全名优先于电子邮件,只有当载荷中的 usernamefull-name 字段为空时,身份验证器才会尝试使用电子邮件进行用户名建议。这是可以通过插件自定义的。但我们不希望默认使用电子邮件作为用户名建议的主要来源,尤其是对于通过 Google 进行身份验证的情况。原因是,在这种情况下,只需在用户名后添加 @gmail.com 就可以找出论坛上所有用户的电子邮件。

1 个赞