ash_authentication/dev/dev_server/clear_session.ex
James Harton a939dde9b9
feat(PasswordAuthentication): Registration and authentication with local credentials (#4)
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.
2022-10-25 11:07:07 +13:00

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