Update docker ENV variable

Re-order clause so recaptcha_response is checked
pull/7416/head
bretep 2 years ago
parent b76151a2cd
commit 81235ffa34
  1. 14
      apps/block_scout_web/lib/block_scout_web/controllers/address_transaction_controller.ex
  2. 4
      docker/Makefile

@ -185,14 +185,15 @@ defmodule BlockScoutWeb.AddressTransactionController do
%{ %{
"address_id" => address_hash_string, "address_id" => address_hash_string,
"from_period" => from_period, "from_period" => from_period,
"to_period" => to_period "to_period" => to_period,
"recaptcha_response" => recaptcha_response
}, },
csv_export_module csv_export_module
) )
when is_binary(address_hash_string) do when is_binary(address_hash_string) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash), {:ok, address} <- Chain.hash_to_address(address_hash),
true <- Application.get_env(:block_scout_web, :recaptcha)[:is_disabled] do {:recaptcha, true} <- {:recaptcha, captcha_helper().recaptcha_passed?(recaptcha_response)} do
address address
|> csv_export_module.export(from_period, to_period) |> csv_export_module.export(from_period, to_period)
|> Enum.reduce_while(put_resp_params(conn), fn chunk, conn -> |> Enum.reduce_while(put_resp_params(conn), fn chunk, conn ->
@ -211,7 +212,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
{:error, :not_found} -> {:error, :not_found} ->
not_found(conn) not_found(conn)
false -> {:recaptcha, false} ->
not_found(conn) not_found(conn)
end end
end end
@ -221,15 +222,14 @@ defmodule BlockScoutWeb.AddressTransactionController do
%{ %{
"address_id" => address_hash_string, "address_id" => address_hash_string,
"from_period" => from_period, "from_period" => from_period,
"to_period" => to_period, "to_period" => to_period
"recaptcha_response" => recaptcha_response
}, },
csv_export_module csv_export_module
) )
when is_binary(address_hash_string) do when is_binary(address_hash_string) do
with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string), with {:ok, address_hash} <- Chain.string_to_address_hash(address_hash_string),
{:ok, address} <- Chain.hash_to_address(address_hash), {:ok, address} <- Chain.hash_to_address(address_hash),
{:recaptcha, true} <- {:recaptcha, captcha_helper().recaptcha_passed?(recaptcha_response)} do true <- Application.get_env(:block_scout_web, :recaptcha)[:is_disabled] do
address address
|> csv_export_module.export(from_period, to_period) |> csv_export_module.export(from_period, to_period)
|> Enum.reduce_while(put_resp_params(conn), fn chunk, conn -> |> Enum.reduce_while(put_resp_params(conn), fn chunk, conn ->
@ -248,7 +248,7 @@ defmodule BlockScoutWeb.AddressTransactionController do
{:error, :not_found} -> {:error, :not_found} ->
not_found(conn) not_found(conn)
{:recaptcha, false} -> false ->
not_found(conn) not_found(conn)
end end
end end

@ -369,8 +369,8 @@ endif
ifdef RE_CAPTCHA_V3_CLIENT_KEY ifdef RE_CAPTCHA_V3_CLIENT_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_V3_CLIENT_KEY=$(RE_CAPTCHA_V3_CLIENT_KEY)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_V3_CLIENT_KEY=$(RE_CAPTCHA_V3_CLIENT_KEY)'
endif endif
ifdef RE_CAPTCHA_IS_ENTERPRISE ifdef RE_CAPTCHA_DISABLED
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_IS_ENTERPRISE=$(RE_CAPTCHA_IS_ENTERPRISE)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'RE_CAPTCHA_DISABLED=$(RE_CAPTCHA_DISABLED)'
endif endif
ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)'

Loading…
Cancel
Save