From dde84df609e0dc6323abdd878b7d2c40abede869 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Mon, 27 Nov 2023 14:38:28 +0100 Subject: [PATCH] Stop relying on app env for self hosted registration --- lib/plausible_web/controllers/auth_controller.ex | 6 ------ lib/plausible_web/live/register_form.ex | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex index a54b34851..d30bff50d 100644 --- a/lib/plausible_web/controllers/auth_controller.ex +++ b/lib/plausible_web/controllers/auth_controller.ex @@ -31,12 +31,6 @@ defmodule PlausibleWeb.AuthController do ] ) - plug(:assign_is_selfhost) - - defp assign_is_selfhost(conn, _opts) do - assign(conn, :is_selfhost, Plausible.Release.selfhost?()) - end - def register(conn, %{"user" => %{"email" => email, "password" => password}}) do with {:ok, user} <- login_user(conn, email, password) do conn = set_user_session(conn, user) diff --git a/lib/plausible_web/live/register_form.ex b/lib/plausible_web/live/register_form.ex index 143ca30de..94c725b80 100644 --- a/lib/plausible_web/live/register_form.ex +++ b/lib/plausible_web/live/register_form.ex @@ -5,6 +5,7 @@ defmodule PlausibleWeb.Live.RegisterForm do use Phoenix.LiveView use Phoenix.HTML + use Plausible import PlausibleWeb.Live.Components.Form @@ -37,7 +38,6 @@ defmodule PlausibleWeb.Live.RegisterForm do form: to_form(changeset), captcha_error: nil, password_strength: Auth.User.password_strength(changeset), - is_selfhost: Plausible.Release.selfhost?(), trigger_submit: false )} end @@ -68,7 +68,7 @@ defmodule PlausibleWeb.Live.RegisterForm do ~H"""

- <%= if @is_selfhost or @live_action == :register_from_invitation_form do %> + <%= if not full_build?() or @live_action == :register_from_invitation_form do %> Register your Plausible Analytics account <% else %> Register your 30-day free trial @@ -162,7 +162,7 @@ defmodule PlausibleWeb.Live.RegisterForm do <% end %> <% submit_text = - if @is_selfhost or @invitation do + if not full_build?() or @invitation do "Create my account →" else "Start my free trial →"