Make sure session cookie salt in AuthController is loaded dynamically

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-09-21 10:16:07 +02:00
parent 6675c62d94
commit 88b4f98c41
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@ defmodule Mobilizon.Web.AuthController do
plug(Plug.Session,
store: :cookie,
key: "_auth_callback",
signing_salt: Keyword.get(endpoint_config, :secret_key_base)
signing_salt: {Mobilizon.Web.AuthController, :secret_key_base, []}
)
plug(Ueberauth)
@ -141,7 +141,9 @@ defmodule Mobilizon.Web.AuthController do
redirect(conn, to: "/login?code=Error with Login Provider&provider=#{provider_name}")
end
defp endpoint_config do
Application.get_env(:mobilizon, Mobilizon.Web.Endpoint, [])
def secret_key_base do
:mobilizon
|> Application.get_env(Mobilizon.Web.Endpoint, [])
|> Keyword.get(:secret_key_base)
end
end