mirror of
https://github.com/plausible/analytics.git
synced 2024-12-04 11:12:04 +03:00
0b7870dc4d
* first launch * dynamic children, wait for repo * remove wait_for_repo and app env manipulations * don't mention free trial in self-hosted pages * add changelog * assigns[:is_selfhost] -> @is_selfhost * better changelog wording * rm admin_user, admin_email, admin_pwd from app env * rm DISABLE_AUTH * redirect / to /login when not authenticated * remove TODO * Update lib/plausible_web/controllers/page_controller.ex Co-authored-by: Uku Taht <Uku.taht@gmail.com> * format Co-authored-by: Uku Taht <Uku.taht@gmail.com>
16 lines
615 B
Elixir
16 lines
615 B
Elixir
defmodule PlausibleWeb.PageController do
|
|
use PlausibleWeb, :controller
|
|
use Plausible.Repo
|
|
|
|
@doc """
|
|
The root path is never accessible in Plausible.Cloud because it is handled by the upstream reverse proxy.
|
|
|
|
This controller action is only ever triggered in self-hosted Plausible. It redirects the user to /login where `PlausibleWeb.RequireLoggedOutPlug` plug kicks in. If they are already logged in, they are redirected to /sites, otherwise they'll see the /login page.
|
|
"""
|
|
def index(conn, _params) do
|
|
conn
|
|
|> put_session(:login_dest, conn.request_path)
|
|
|> redirect(to: "/login")
|
|
end
|
|
end
|