mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: Add safe-mode toggle to /u/admin-login
(#17930)
Previously, this would require manually adding `?safe_mode=...` multiple times during the email-based login flow. `/u/admin-login` is often used when debugging a site, so it makes sense for this to be easier. This commit introduces a new checkbox on the `/u/admin-login` screen. When checked, it'll set the safe_mode parameter on the `/email-login` link, and then pass it all the way through to the homepage redirect.
This commit is contained in:
@ -961,7 +961,11 @@ class UsersController < ApplicationController
|
||||
|
||||
if user = User.with_email(params[:email]).admins.human_users.first
|
||||
email_token = user.email_tokens.create!(email: user.email, scope: EmailToken.scopes[:email_login])
|
||||
Jobs.enqueue(:critical_user_email, type: "admin_login", user_id: user.id, email_token: email_token.token)
|
||||
token_string = email_token.token
|
||||
if params["use_safe_mode"]
|
||||
token_string += "?safe_mode=no_plugins,no_themes"
|
||||
end
|
||||
Jobs.enqueue(:critical_user_email, type: "admin_login", user_id: user.id, email_token: token_string)
|
||||
@message = I18n.t("admin_login.success")
|
||||
else
|
||||
@message = I18n.t("admin_login.errors.unknown_email_address")
|
||||
|
Reference in New Issue
Block a user