mirror of
https://github.com/plausible/analytics.git
synced 2024-11-24 21:58:56 +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
|