class BindUsersController < ApplicationController
  before_action :require_login

  def create
    user = CreateBindUserService.call(current_user, create_params)
    successful_authentication(user) if user.id != current_user.id

    render_ok
  rescue ApplicationService::Error => ex
    render_error(ex.message)
  end

  def new_user
    current_user
  end

  private

  def create_params
    params.permit(:username, :password, :type, :not_bind)
  end
end