Welcome to mirror list, hosted at ThFree Co, Russian Federation.

devise_failure.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c48ad3b46bc7695283baf220082a0af8ba651bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  class DeviseFailure < Devise::FailureApp
    # If the request format is not known, send a redirect instead of a 401
    # response, since this is the outcome we're most likely to want
    def http_auth?
      request_format && super
    end

    def respond
      if warden_options[:reason] == :too_many_requests
        self.status = 403
      else
        super
      end
    end
  end
end

Gitlab::DeviseFailure.prepend_mod