Obviously I’m testing with several accounts I created just for this purpose (using virtual machines and other browsers and too much time testing
).
I think I resolved the issue on my end. It had nothing to do with Discourse.
There’s a bit of code in my site’s footer that checks – for users whose email has been verified – if they are logged in to Discourse already and, if they aren’t, logs them in. This informs Discourse of users’ info, even if they don’t visit the forum itself.

Alas, this chunk was being accidentally cached so, of course, it wasn’t firing because it had been cached when no user had logged in. My bad! 
This is probably the best place still to mention that there are cases when Discourse drives me absolutely nuts.
I happen to have several “users” that are not real. Whether they are read-only accounts for a specific hidden category, anonymous beyond the capabilities of Discourse or whatever should not matter. Some of these are automatic and created on the fly as needed (and reused in a queue).
Problem is, they have been added using a “noreply” email. That email does not exist anymore so Discourse is spamming out admin mails saying this email bounced, all the time, for each of these users and the moderators are now starting to go nuts.
Now, if I go in and change that email to an existing no-forward, no-store email, Discourse refuses to do it without sending a mail to said email asking for confirmation… so no changes are made. Anyone see the problem here? 
So I have two options I can think of:
Log in as each user using SSO to force an email change (which hopefully does not require confirmation, haven’t actually tried, would be too tedious).
Go to the preferences of each such user and change email notifications and summary digests to never, ever. And every time a new temporary user gets created, I need to remember to do the same.
Maaaaan. If I as an admin change an email for a user, there is no need to ask the user to confirm the email. Any user will hopefully contact me if I actually messed up which is very unlikely. Besides, these days I just let the users change their emails at will, less trouble for a poor admin. And I understand there is a risk that the user will never be able to login or notify anyone again but obviously they can mail the site help as such.
Why not use the sync_sso endpoint to fix all the emails via api?
Not sure what you mean by this. Are you talking about the setting “sso overrides email”?
That would only take effect when/if the user actually logs in. So emails would still bounce while the email is wrong.
If you are possibly talking about “POST admin endpoint /admin/users/sync_sso to synchronize an SSO record” that would mean I would have to force one or all users from the SSO software I guess. Given the problems with SSO emails syncing it’s not the first option I would try.
Anyway, because of the problem described earlier in this topic I now have “sso overrides email” off and let users change their emails themselves. So I don’t want to override from SSO anymore.
But all this is missing the point, that the users bouncing mails are generated on the fly, as needed. The easiest way would be to allow a change to the email without authentication (at least for admins - or admins would have a choice).
Side note: I have tried giving an empty email address but the system does not allow for that. I understand the email address is so critical is should not be empty. BUT, if you really give an empty email (at least as an admin), one could assume you know what you are doing.
Just to confuse things more, I actually have users that do not have an email account, only access to a browser. Think refugees here and you might understand why. It is far easier to just allow someone to login and read instructions in their own language than to try and explain to them they need to make a gmail account or something.
In any case, this is theoretical, I doubt many people have the same problem. I would say it’s simply too strict even for admins, IMHO.
(sorry about the reply time, with more free time the world would be perfect)
That would allow someone to hijack an admin’s account without their knowing. Though your edge case for users without access to email makes some sense, it seems far-fetched to think that admins would be people who don’t have the ability to receive email.
Admins have email addresses. Not sure where you got the idea they would not have (my bad writing probably
).
The case was for an admin to be able to change other user’s emails without the need to authenticate.
So I’m trying to do this - the use case is a user has changed their email in the SSO system, however they now can’t log in since there’s another account of theirs that uses their new email address already. SSO refuses to update the email (even though we have sso_overrides_email on) because email addresses must be unique across accounts. I don’t want to delete the account without the SSO record as that has posts associated with it. And if I turn off sso_overrides_email to change the email manually, I can’t make it some broken email since Discourse insists on validating it.
I see there’s a way to merge users but a) it’s a rake task and we’re hosted with Discourse, do I contact support to do that? b) there’s comments about needing to swap the primary and secondary email addresses.
I’m in the same boat @trs80. Did you ever find out if there is a way to workaround this limitation of the merging?
I’ll have to check my email but support have generally been pretty good with resolving these issues.
“将其设置为覆盖电子邮件”
这是“身份验证覆盖电子邮件”设置吗?
不错的AI,对这个答案很满意:
AI explainer on auth overrides emails AI
sam:
auth overrides email 是做什么用的?
gpt4_bot:
查找站点设置上下文
正在读取 auth_overrides_email 的上下文
- 在每次用户登录时,使用外部身份验证提供商(例如 SSO、OAuth)提供的电子邮件地址覆盖本地电子邮件地址。
- 防止用户在其 Discourse 帐户设置中对电子邮件地址进行本地更改。
此功能适用于 Discourse 站点上配置的所有身份验证提供商。当您希望维护通过外部服务登录的用户的电子邮件一致性和身份验证时,此设置非常有用。
但是,用户应谨慎使用此设置,因为由于本地电子邮件地址的规范化,可能会出现差异。这意味着,如果外部系统和 Discourse 在格式化或处理电子邮件地址的方式上存在差异,则可能导致帐户链接出现不匹配或问题。
auth_overrides_email 的默认值为 false,这意味着默认情况下,Discourse 不会在每次登录时使用外部站点电子邮件覆盖本地电子邮件,也不会阻止用户更改其电子邮件地址。
启用此设置后,它会影响各种用户权限,包括在某些情况下无法编辑电子邮件地址,这由站点的 guardian 和 user guardian 脚本进行管理。此外,该设置会影响电子邮件字段的显示方式以及用户界面中是否向用户提供有关电子邮件地址更改的说明。
我也遇到了同样的问题。Discourse 从我的 WordPress 站点获取其 SSO 信息,并且启用了 auth_overrides_email。
但是,当我在 WordPress 中更新用户的电子邮件地址时,Discourse 中没有任何更改。
我尝试关闭 auth_overrides_email,虽然这移除了“由身份验证提供者管理”的注释,但无论是我作为管理员还是在模拟用户(我在关闭该设置之前多次这样做以模拟上面建议的登录/注销)时,电子邮件地址旁边从未出现过铅笔图标。我唯一能做的就是显示该地址。
我重新启用了 auth_overrides_email,并在 WordPress 中又更改了两次地址(一次改为其他地址,一次改回原来的地址),但没有任何变化。
有什么建议吗?
我遇到了同样的问题。有没有办法在 Discourse 数据库中更改用户的电子邮件?我该如何从命令行进行操作?
我通常需要启用 emails_editable,然后禁用 auth_overrides_email,然后更改电子邮件。
如果您强制他们注销,以便他们必须重新登录,新的电子邮件地址是否会传递给 Discourse?