1
0
postdoc/app/controllers/api/base_controller.rb

22 lines
451 B
Ruby
Raw Normal View History

2020-12-06 20:49:03 +01:00
module Api
class BaseController < ActionController::Base
before_action :authenticate_mailbox
protect_from_forgery with: :null_session
def require_mailbox
end
def authenticate_mailbox
authenticate_or_request_with_http_token do |token, _options|
puts token
Mailbox.find_by(sendgrid_mock_api_token: token)
end
end
def current_mailbox
@mailbox ||= authenticate_mailbox
end
end
end