This guide explains how to log back into Discourse as an admin when you have been locked out.
Required user level: Administrator
If you’ve locked yourself out of your Discourse instance with an invalid SSO configuration, append /u/admin-login to the end of your forum’s root URL:
https://discourse.example.com/u/admin-login
This will take you to an admin login page:
You’ll be sent an email with a login link that circumvents SSO and read-only mode, allowing you to login as needed.
If you have 2-factor authentication enabled you’ll still have to enter your auth code.
Alternative method requiring console access
Disable SSO
cd /var/discourse
./launcher enter app
rails c
irb > SiteSetting.enable_discourse_connect = false
irb > SiteSetting.enable_local_logins = true
irb > exit
exit
Disable read-only mode
cd /var/discourse
./launcher enter app
rails c
irb > Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
irb > exit
exit
Last edited by @hugh 2024-07-30T05:41:29Z
Last checked by @hugh 2024-07-30T05:41:34Z
Check document
Perform check on document:
18 个赞
nory
6
您好,我无法访问我的论坛。
我启用了只读模式,但现在无法访问管理员。
当我转到“/u/admin-login”并输入我的管理员电子邮件时,我收到此错误:
“{“errors”:[“站点处于只读模式。交互已禁用。”],“error_type”:“read_only”}”
通过控制台访问也不起作用 
我该如何解决?
提前感谢。
2 个赞
我认为你可以在 rails 控制台中运行它来关闭它:
Moin
10
是吗?当我输入我的电子邮件并单击 发送电子邮件 时,我看到:
该网站处于只读模式。交互已禁用。
并且没有发送电子邮件。
3 个赞
感谢你的报告@Moin,这应该能(一劳永逸地
)解决问题
5 个赞