Process review comments

pull/7946/head
Nikita Pozdniakov 1 year ago
parent f86e6b2b86
commit 01426d70a1
No known key found for this signature in database
GPG Key ID: F344106F9804FE5F
  1. 2
      apps/block_scout_web/config/config.exs
  2. 4
      apps/block_scout_web/lib/block_scout_web/controllers/api/v2/api_key_controller.ex

@ -13,7 +13,7 @@ config :block_scout_web,
# 604800 seconds, 1 week
session_cookie_ttl: 60 * 60 * 24 * 7,
invalid_session_key: "invalid_session",
api_v2_temp_token_key: "api_v2_temp_client_key"
api_v2_temp_token_key: "api_v2_temp_token"
config :block_scout_web,
admin_panel_enabled: System.get_env("ADMIN_PANEL_ENABLED", "") == "true"

@ -9,6 +9,10 @@ defmodule BlockScoutWeb.API.V2.APIKeyController do
plug(:fetch_cookies, signed: [@api_v2_temp_token_key])
@doc """
Function to handle POST requests to `/api/v2/key` endpoint. It expects body with `recaptcha_response`. And puts cookie with temporary API v2 token. Which is handled here: https://github.com/blockscout/blockscout/blob/cd19739347f267d8a6ad81bbba2dbdad08bcc134/apps/block_scout_web/lib/block_scout_web/views/access_helper.ex#L170
"""
@spec get_key(Plug.Conn.t(), nil | map) :: {:recaptcha, any} | Plug.Conn.t()
def get_key(conn, params) do
helper = Application.get_env(:block_scout_web, :captcha_helper)
ttl = Application.get_env(:block_scout_web, :api_rate_limit)[:api_v2_token_ttl_seconds]

Loading…
Cancel
Save