mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-25 08:39:38 -05:00
18 lines
359 B
Ruby
18 lines
359 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 on as the user
|
|
log_on_user(user)
|
|
|
|
render nothing: true
|
|
end
|
|
|
|
end
|