internetee-registry/app/controllers/registrar/current_user_controller.rb
Alex Sherman 8cc42cb170 Fix redirect back
Closes #1535
2020-02-28 13:55:01 +05:00

18 lines
454 B
Ruby

class Registrar
class CurrentUserController < BaseController
skip_authorization_check
def switch
raise 'Cannot switch to unlinked user' unless current_registrar_user.linked_with?(new_user)
sign_in(:registrar_user, new_user)
redirect_back(fallback_location: root_path, notice: t('.switched', new_user: new_user))
end
private
def new_user
@new_user ||= ApiUser.find(params[:new_user_id])
end
end
end