discourse/app/controllers/admin/impersonate_controller.rb
Bianca Nenciu 5af9a69a3b FIX: Do not check for suspicious login when impersonating. (#6534)
* FIX: Do not check for suspicious login when impersonating.

* DEV: Add 'impersonate' parameter to log_on_user.
2018-11-12 15:34:12 +01:00

21 lines
458 B
Ruby

class Admin::ImpersonateController < Admin::AdminController
def create
params.require(:username_or_email)
user = User.find_by_username_or_email(params[:username_or_email])
raise Discourse::NotFound if user.blank?
guardian.ensure_can_impersonate!(user)
# log impersonate
StaffActionLogger.new(current_user).log_impersonate(user)
# Log on as the user
log_on_user(user, impersonate: true)
render body: nil
end
end