Mattias Bodlund 1 week ago
parent
commit
360e22c4ff
2 changed files with 9 additions and 1 deletions
  1. +1
    -0
      app/controllers/api/v1/leaderboard_controller.rb
  2. +8
    -1
      app/controllers/application_controller.rb

+ 1
- 0
app/controllers/api/v1/leaderboard_controller.rb View File

@ -1,6 +1,7 @@
class Api::V1::LeaderboardController < ApplicationController class Api::V1::LeaderboardController < ApplicationController
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
skip_before_action :authenticate skip_before_action :authenticate
ACCESS_TOKEN = "ikea-tomato-2026" ACCESS_TOKEN = "ikea-tomato-2026"
before_action :set_cors_headers, :set_locale_to_default, :verify_access_token before_action :set_cors_headers, :set_locale_to_default, :verify_access_token


+ 8
- 1
app/controllers/application_controller.rb View File

@ -1,8 +1,13 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
http_basic_authenticate_with name: "stupid", password: "studio" if Rails.env.production?
before_action :authenticate
private private
def authenticate
http_basic_authenticate_with name: "stupid", password: "studio" if Rails.env.production?
end
def set_locale def set_locale
I18n.locale = params[:locale].presence_in(I18n.available_locales.map(&:to_s)) || I18n.default_locale I18n.locale = params[:locale].presence_in(I18n.available_locales.map(&:to_s)) || I18n.default_locale
@ -12,4 +17,6 @@ private
def not_found def not_found
raise ActionController::RoutingError.new("Not Found") raise ActionController::RoutingError.new("Not Found")
end end
end end

Loading…
Cancel
Save