20 lines
451 B
Elixir
20 lines
451 B
Elixir
|
|
defmodule EzcontainerRailwayWeb.NoRailwayCheck do
|
||
|
|
alias EzcontainerRailway.Projects
|
||
|
|
alias Phoenix.Controller
|
||
|
|
import Plug.Conn
|
||
|
|
|
||
|
|
def init(default), do: default
|
||
|
|
|
||
|
|
def call(conn, _opts) do
|
||
|
|
case get_session(conn, :railway_token) do
|
||
|
|
nil ->
|
||
|
|
conn
|
||
|
|
_ ->
|
||
|
|
conn
|
||
|
|
|> Controller.put_flash(:info, "You have a railway token")
|
||
|
|
|> Controller.redirect(to: "/containers/create")
|
||
|
|
|> halt()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|