mirror of
https://github.com/plausible/analytics.git
synced 2024-11-28 13:02:53 +03:00
17 lines
298 B
Elixir
17 lines
298 B
Elixir
defmodule PlausibleWeb.RequireLoggedOutPlug do
|
|
def init(options) do
|
|
options
|
|
end
|
|
|
|
def call(conn, _opts) do
|
|
cond do
|
|
conn.assigns[:current_user] ->
|
|
conn
|
|
|> Phoenix.Controller.redirect(to: "/")
|
|
|> Plug.Conn.halt
|
|
:else ->
|
|
conn
|
|
end
|
|
end
|
|
end
|