fix: Remove Persistent Session to avoid log out issue
This commit is contained in:
parent
cd9b84488e
commit
a689922c5e
3 changed files with 2 additions and 8 deletions
|
@ -64,6 +64,6 @@ defmodule AppWeb.Endpoint do
|
||||||
plug Plug.Head
|
plug Plug.Head
|
||||||
plug Plug.Session, @session_options
|
plug Plug.Session, @session_options
|
||||||
plug Pow.Plug.Session, otp_app: :core
|
plug Pow.Plug.Session, otp_app: :core
|
||||||
plug PowPersistentSession.Plug.Cookie
|
# plug PowPersistentSession.Plug.Cookie
|
||||||
plug AppWeb.Router
|
plug AppWeb.Router
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,15 +11,9 @@ defmodule Legendary.AuthWeb.Plugs.RequireAdmin do
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(conn, _opts) do
|
def call(conn, _opts) do
|
||||||
IO.puts "XXXXXX"
|
|
||||||
IO.inspect(Pow.Plug.current_user(conn))
|
|
||||||
IO.puts "XXXXXX"
|
|
||||||
IO.inspect(conn |> Plug.Conn.fetch_session() |> Plug.Conn.get_session())
|
|
||||||
IO.puts "XXXXXX"
|
|
||||||
with user = %User{} <- Pow.Plug.current_user(conn),
|
with user = %User{} <- Pow.Plug.current_user(conn),
|
||||||
true <- Roles.has_role?(user, "admin")
|
true <- Roles.has_role?(user, "admin")
|
||||||
do
|
do
|
||||||
IO.puts "OK"
|
|
||||||
conn
|
conn
|
||||||
else
|
else
|
||||||
_ ->
|
_ ->
|
||||||
|
|
|
@ -39,7 +39,7 @@ end)
|
||||||
config :core, :pow,
|
config :core, :pow,
|
||||||
user: Legendary.Auth.User,
|
user: Legendary.Auth.User,
|
||||||
repo: Legendary.Core.Repo,
|
repo: Legendary.Core.Repo,
|
||||||
extensions: [PowEmailConfirmation, PowPersistentSession, PowResetPassword],
|
extensions: [PowEmailConfirmation, PowResetPassword],
|
||||||
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
|
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
|
||||||
mailer_backend: Legendary.AuthWeb.Pow.Mailer,
|
mailer_backend: Legendary.AuthWeb.Pow.Mailer,
|
||||||
web_mailer_module: Legendary.AuthWeb,
|
web_mailer_module: Legendary.AuthWeb,
|
||||||
|
|
Loading…
Reference in a new issue