1
0

authorizations_controller.rb 706 B

123456789101112131415161718192021222324252627282930
  1. # frozen_string_literal: true
  2. class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
  3. skip_before_action :authenticate_resource_owner!
  4. before_action :store_current_location
  5. before_action :authenticate_resource_owner!
  6. include Localized
  7. private
  8. def store_current_location
  9. store_location_for(:user, request.url)
  10. end
  11. def render_success
  12. if skip_authorization? || (matching_token? && !truthy_param?('force_login'))
  13. redirect_or_render authorize_response
  14. elsif Doorkeeper.configuration.api_only
  15. render json: pre_auth
  16. else
  17. render :new
  18. end
  19. end
  20. def truthy_param?(key)
  21. ActiveModel::Type::Boolean.new.cast(params[key])
  22. end
  23. end