Found this via searches.
So basically, executing this in rails console
:
Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
will get you out of readonly mode, and then you can login.
Moral of the story? Don’t log out after activating readonly mode.