# Log back in as admin after locking yourself out with read-only mode or an invalid SSO configuration

**URL:** https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605
**Category:** Site Management
**Tags:** how-to, read-only
**Created:** [6월 11, 2018, 11:28오전 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605 "2018-06-11T11:28:30Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [7월 8, 2025, 3:46오후 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/14 "2025-07-08T15:46:00Z")

</div>

@Moin, 보고해 주셔서 감사합니다. 이제 (한 번에, 그리고 영원히) 수정될 것입니다 🤞

> <https://github.com/discourse/discourse/pull/33521>
>
> The reasons for these changes is https://meta.discourse.org/t/-/89605 broke and …admins were not able to log back in if they had previously enabled the "read only" mode.
> 
> Thus ensued a deep dive into how all the "read only" modes worked, which was made difficult due to the lack of tests.
> 
> The "cornerstone" of this PR is the \`read\_only\_mixin.rb\` file which was improved to be able to differentiate between the "readonly" mode and the "staff writes only" mode.
> 
> I then made use of the \`allow\_in\_readonly\_mode\` and \`allow\_in\_staff\_writes\_only\_mode\` method to \*\*explicitely\*\* list all the actions that should work in those modes.
> 
> I also added the "readonly" mixin to the \`WebhooksController\` since it doesn't inherit from the \`ApplicationController\`.
> 
> I improved the security of the \`/u/admin-login\` endpoint by always sending the same message no matter if we found or not an admin account with the provided email address.
> 
> I added two system specs:
> 
> 1. for ensuring that admins can log in via /u/admin-lgoin and then clicking the link in the email they received while the site is in readonly mode.
> 2. for ensuring the "staff writes only mode" is \_actually\_ tested by ensuring a moderator can log in and create a topic while the site is in that mode.
> 
> Plenty of specs were updated to ensure 100% converage of the various "read only" modes.

---

_[View the full topic](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605)._
