work off today

This commit is contained in:
2020-02-25 11:09:27 -05:00
parent da2ba6230d
commit 8740300b9a
34 changed files with 657 additions and 662 deletions
+19 -4
View File
@@ -1,5 +1,19 @@
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
module Qwaiter
class FailureApp < Devise::FailureApp
def respond
if request.format.json?
json_api_error_response
else
super
end
end
def json_api_error_response
self.status = 401
self.content_type = 'application/json'
self.response_body = { errors: [{ status: '401', title: i18n_message }]}.to_json
end
end
end
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
@@ -250,10 +264,11 @@ Devise.setup do |config|
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
config.warden do |manager|
manager.failure_app = Qwaiter::FailureApp
# manager.intercept_401 = false
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine