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

base.rb « strategies « otp « auth « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7d8513642c4106a677a10e8e28c8605ab912dc51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module Gitlab
  module Auth
    module Otp
      module Strategies
        class Base
          def initialize(user)
            @user = user
          end

          private

          attr_reader :user

          def success
            { status: :success }
          end

          def error(message, http_status = nil)
            result = { message: message,
                       status: :error }

            result[:http_status] = http_status if http_status

            result
          end

          def error_from_response(response)
            error(response.message, response.code)
          end
        end
      end
    end
  end
end