Class: Ibrain::Auth::FailureApp

Inherits:
Devise::FailureApp
  • Object
show all
Includes:
ActionController::Helpers
Defined in:
lib/ibrain/auth/failure_app.rb

Instance Method Summary collapse

Instance Method Details

#json_error_responseObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ibrain/auth/failure_app.rb', line 10

def json_error_response
  self.status = 401
  self.content_type = "application/json"
  self.response_body = {
    errors: [{
            message: i18n_message,
            extensions: {
              code: 401,
              exception: {
                stacktrace: []
              }
            }
          }],
          message: i18n_message,
          data: nil
        }.to_json
end

#respondObject



6
7
8
# File 'lib/ibrain/auth/failure_app.rb', line 6

def respond
  json_error_response
end