mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
14 lines
337 B
Elixir
14 lines
337 B
Elixir
|
defmodule PhilomenaWeb.NotAuthorizedPlug do
|
||
|
alias Phoenix.Controller
|
||
|
alias Plug.Conn
|
||
|
|
||
|
def init([]), do: []
|
||
|
|
||
|
def call(conn), do: call(conn, nil)
|
||
|
def call(conn, _opts) do
|
||
|
conn
|
||
|
|> Controller.put_flash(:error, "You can't access that page.")
|
||
|
|> Controller.redirect(to: conn.assigns.referrer)
|
||
|
|> Conn.halt()
|
||
|
end
|
||
|
end
|