From 360e22c4ff2c48f76f2fae32e2d1d5f2284df1e1 Mon Sep 17 00:00:00 2001 From: Mattias Bodlund Date: Tue, 28 Apr 2026 15:14:40 +0200 Subject: [PATCH] na --- app/controllers/api/v1/leaderboard_controller.rb | 1 + app/controllers/application_controller.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/leaderboard_controller.rb b/app/controllers/api/v1/leaderboard_controller.rb index 6b14bc2..70f3d1f 100644 --- a/app/controllers/api/v1/leaderboard_controller.rb +++ b/app/controllers/api/v1/leaderboard_controller.rb @@ -1,6 +1,7 @@ class Api::V1::LeaderboardController < ApplicationController skip_before_action :verify_authenticity_token skip_before_action :authenticate + ACCESS_TOKEN = "ikea-tomato-2026" before_action :set_cors_headers, :set_locale_to_default, :verify_access_token diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index aff3ca0..37dfeff 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,8 +1,13 @@ class ApplicationController < ActionController::Base - http_basic_authenticate_with name: "stupid", password: "studio" if Rails.env.production? + before_action :authenticate + private + def authenticate + http_basic_authenticate_with name: "stupid", password: "studio" if Rails.env.production? + end + def set_locale I18n.locale = params[:locale].presence_in(I18n.available_locales.map(&:to_s)) || I18n.default_locale @@ -12,4 +17,6 @@ private def not_found raise ActionController::RoutingError.new("Not Found") end + + end