mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-20 13:24:20 +12:00
a939dde9b9
This is missing a bunch of features that you probably want to use (eg confirmation, password resets), but it's a pretty good place to put a stake in the sand and say it works.
23 lines
465 B
Elixir
23 lines
465 B
Elixir
defmodule DevServer.ClearSession do
|
|
@moduledoc """
|
|
Resets the session storage, to 'log out" all actors.
|
|
"""
|
|
|
|
@behaviour Plug
|
|
alias Plug.Conn
|
|
|
|
@doc false
|
|
@impl true
|
|
@spec init(keyword) :: keyword
|
|
def init(opts), do: opts
|
|
|
|
@doc false
|
|
@impl true
|
|
@spec call(Conn.t(), any) :: Conn.t()
|
|
def call(conn, _opts) do
|
|
conn
|
|
|> Conn.clear_session()
|
|
|> Conn.put_resp_header("location", "/")
|
|
|> Conn.send_resp(302, "Redirected")
|
|
end
|
|
end
|