Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
App layout refactor: Phase 3 (#6600)
RobertJoonasaf28f76b99d8
diff --git a/extra/lib/plausible_web/controllers/sso_controller.ex b/extra/lib/plausible_web/controllers/sso_controller.exindex 4c221cbf36..7f31625d36 100644--- a/extra/lib/plausible_web/controllers/sso_controller.ex+++ b/extra/lib/plausible_web/controllers/sso_controller.ex@@ -24,9 +24,9 @@ defmodule PlausibleWeb.SSOController doredirect(conn, to: Routes.auth_path(conn, :login_form, return_to: params["return_to"]))_ ->- render_auth_page(conn, "login_form.html",- autosubmit: params["autosubmit"] != nil,- heading: "Sign in with SSO"+ render(conn, "login_form.html",+ legacy_layout?: false,+ autosubmit: params["autosubmit"] != nil)endend@@ -65,7 +65,7 @@ defmodule PlausibleWeb.SSOController doenddef provision_notice(conn, _params) do- render_auth_page(conn, "provision_notice.html", heading: "Single Sign-On required")+ render(conn, "provision_notice.html", legacy_layout?: false)enddef provision_issue(conn, params) do@@ -79,10 +79,7 @@ defmodule PlausibleWeb.SSOController do_ -> :unknownend- render_auth_page(conn, "provision_issue.html",- heading: "Single Sign-On required",- issue: issue- )+ render(conn, "provision_issue.html", legacy_layout?: false, issue: issue)enddef saml_signin(conn, params) dodiff --git a/extra/lib/plausible_web/templates/sso/login_form.html.heex b/extra/lib/plausible_web/templates/sso/login_form.html.heexindex ff4b403811..46bd800435 100644--- a/extra/lib/plausible_web/templates/sso/login_form.html.heex+++ b/extra/lib/plausible_web/templates/sso/login_form.html.heex@@ -1,54 +1,56 @@-<.auth_container>- <script :if={@autosubmit}>- document.addEventListener("DOMContentLoaded", function () {- document.getElementById("sso-login-form").submit();- });- </script>+<Layouts.auth heading="Sign in with SSO" flash={@flash}>+ <.auth_container>+ <script :if={@autosubmit}>+ document.addEventListener("DOMContentLoaded", function () {+ document.getElementById("sso-login-form").submit();+ });+ </script>- <.form- :let={f}- id="sso-login-form"- for={@conn}- action={Routes.sso_path(@conn, :login)}- class="flex flex-col gap-y-6"- >- <div class="flex flex-col gap-y-2">- <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">- </label>- <div>- <.input- type="email"- autocomplete="username"- placeholder="[email protected]"- field={f[:email]}- mt?={false}- autofocus="autofocus"- />+ <.form+ :let={f}+ id="sso-login-form"+ for={@conn}+ action={Routes.sso_path(@conn, :login)}+ class="flex flex-col gap-y-6"+ >+ <div class="flex flex-col gap-y-2">+ <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">+ </label>+ <div>+ <.input+ type="email"+ autocomplete="username"+ placeholder="[email protected]"+ field={f[:email]}+ mt?={false}+ autofocus="autofocus"+ />+ </div>+ <p+ :if={login_error = Phoenix.Flash.get(@flash, :login_error)}+ class="text-xs text-red-500"+ >+ {login_error}+ </p></div>- <p- :if={login_error = Phoenix.Flash.get(@flash, :login_error)}- class="text-xs text-red-500"- >- {login_error}- </p>- </div>- <input type="hidden" name="return_to" value={@conn.params["return_to"]} />+ <input type="hidden" name="return_to" value={@conn.params["return_to"]} />- <div class="flex flex-col gap-y-4">- <.button class="w-full" type="submit" mt?={false}>Sign in</.button>+ <div class="flex flex-col gap-y-4">+ <.button class="w-full" type="submit" mt?={false}>Sign in</.button>- <p class="text-sm text-center text-gray-500 dark:text-gray-400">- <.styled_link href={- Routes.auth_path(@conn, :login_form,- return_to: @conn.params["return_to"],- prefer: "manual"- )- }>- Use password instead- </.styled_link>- </p>- </div>- </.form>-</.auth_container>+ <p class="text-sm text-center text-gray-500 dark:text-gray-400">+ <.styled_link href={+ Routes.auth_path(@conn, :login_form,+ return_to: @conn.params["return_to"],+ prefer: "manual"+ )+ }>+ Use password instead+ </.styled_link>+ </p>+ </div>+ </.form>+ </.auth_container>+</Layouts.auth>diff --git a/extra/lib/plausible_web/templates/sso/provision_issue.html.heex b/extra/lib/plausible_web/templates/sso/provision_issue.html.heexindex e26a39e671..c76b61a62e 100644--- a/extra/lib/plausible_web/templates/sso/provision_issue.html.heex+++ b/extra/lib/plausible_web/templates/sso/provision_issue.html.heex@@ -1,38 +1,40 @@-<.auth_container>- <div class="flex flex-col items-center gap-y-4 text-center text-base text-gray-500 dark:text-gray-400 text-pretty">- <p>- The owner of- <span :if={is_nil(@conn.assigns[:current_team])}>the team</span><span- :if={@conn.assigns[:current_team]}- class="font-semibold"- >"{@conn.assigns[:current_team].name}"</span>- has turned off email and password logins, so you can only sign in with your organization's Single Sign-On.- <span :if={@issue == :not_a_member}>- To access this team, you must be added as a team member first.- </span>- <span :if={@issue == :multiple_memberships}>- To access this team, you must leave all other teams first.- </span>- <span :if={@issue == :multiple_memberships_noforce}>- To sign in with SSO, you must leave all other teams first.- </span>- <span :if={@issue == :active_personal_team}>- To access this team, remove or transfer all sites under- <span class="font-semibold">"My Personal Sites"</span>- and cancel its subscription if active.- </span>- <span :if={@issue == :active_personal_team_noforce}>- To sign in with SSO, remove or transfer all sites under- <span class="font-semibold">"My Personal Sites"</span>- and cancel its subscription if active.- </span>- </p>+<Layouts.auth heading="Single Sign-On required">+ <.auth_container>+ <div class="flex flex-col items-center gap-y-4 text-center text-base text-gray-500 dark:text-gray-400 text-pretty">+ <p>+ The owner of+ <span :if={is_nil(@conn.assigns[:current_team])}>the team</span><span+ :if={@conn.assigns[:current_team]}+ class="font-semibold"+ >"{@conn.assigns[:current_team].name}"</span>+ has turned off email and password logins, so you can only sign in with your organization's Single Sign-On.+ <span :if={@issue == :not_a_member}>+ To access this team, you must be added as a team member first.+ </span>+ <span :if={@issue == :multiple_memberships}>+ To access this team, you must leave all other teams first.+ </span>+ <span :if={@issue == :multiple_memberships_noforce}>+ To sign in with SSO, you must leave all other teams first.+ </span>+ <span :if={@issue == :active_personal_team}>+ To access this team, remove or transfer all sites under+ <span class="font-semibold">"My Personal Sites"</span>+ and cancel its subscription if active.+ </span>+ <span :if={@issue == :active_personal_team_noforce}>+ To sign in with SSO, remove or transfer all sites under+ <span class="font-semibold">"My Personal Sites"</span>+ and cancel its subscription if active.+ </span>+ </p>- <p :if={[email protected][:current_user]}>- <.styled_link href={Routes.auth_path(@conn, :login_form, prefer: "manual")}>- Sign in with email and password- </.styled_link>- to resolve the issue.- </p>- </div>-</.auth_container>+ <p :if={[email protected][:current_user]}>+ <.styled_link href={Routes.auth_path(@conn, :login_form, prefer: "manual")}>+ Sign in with email and password+ </.styled_link>+ to resolve the issue.+ </p>+ </div>+ </.auth_container>+</Layouts.auth>diff --git a/extra/lib/plausible_web/templates/sso/provision_notice.html.heex b/extra/lib/plausible_web/templates/sso/provision_notice.html.heexindex dbac07d344..e278edbe7d 100644--- a/extra/lib/plausible_web/templates/sso/provision_notice.html.heex+++ b/extra/lib/plausible_web/templates/sso/provision_notice.html.heex@@ -1,17 +1,19 @@-<.auth_container>- <div class="flex flex-col items-center gap-y-4 text-center text-base text-gray-500 dark:text-gray-400 text-pretty">- <p>- The owner of- <span :if={is_nil(@conn.assigns[:current_team])}>the team</span><span- :if={@conn.assigns[:current_team]}- class="font-semibold"- >"{@conn.assigns[:current_team].name}"</span>- has turned off email and password logins, so you can only sign in with your organization's Single Sign-On.- </p>- <p>- To access this team,- <.styled_link href={Routes.auth_path(@conn, :logout)}>sign out</.styled_link>- and sign in with SSO.- </p>- </div>-</.auth_container>+<Layouts.auth heading="Single Sign-On required">+ <.auth_container>+ <div class="flex flex-col items-center gap-y-4 text-center text-base text-gray-500 dark:text-gray-400 text-pretty">+ <p>+ The owner of+ <span :if={is_nil(@conn.assigns[:current_team])}>the team</span><span+ :if={@conn.assigns[:current_team]}+ class="font-semibold"+ >"{@conn.assigns[:current_team].name}"</span>+ has turned off email and password logins, so you can only sign in with your organization's Single Sign-On.+ </p>+ <p>+ To access this team,+ <.styled_link href={Routes.auth_path(@conn, :logout)}>sign out</.styled_link>+ and sign in with SSO.+ </p>+ </div>+ </.auth_container>+</Layouts.auth>diff --git a/extra/lib/plausible_web/views/sso_view.ex b/extra/lib/plausible_web/views/sso_view.exindex cb14fa1931..bb275f9e75 100644--- a/extra/lib/plausible_web/views/sso_view.ex+++ b/extra/lib/plausible_web/views/sso_view.ex@@ -1,3 +1,5 @@defmodule PlausibleWeb.SSOView douse PlausibleWeb, :extra_view++ alias PlausibleWeb.Layoutsenddiff --git a/lib/plausible_web/components/layouts.ex b/lib/plausible_web/components/layouts.exindex e7b46c6c3c..6e3ddca889 100644--- a/lib/plausible_web/components/layouts.ex+++ b/lib/plausible_web/components/layouts.ex@@ -107,4 +107,33 @@ defmodule PlausibleWeb.Layouts do</.app>"""end++ attr :heading, :string, required: true+ attr :subtitle, :string, default: nil+ attr :flash, :map, default: %{}+ slot :inner_block, required: true++ def auth(assigns) do+ ~H"""+ <.app header?={false} footer?={false} global_notices?={false} flash={@flash}>+ <div class="min-h-screen w-full bg-white dark:bg-gray-900">+ <div class="flex justify-center pt-12 sm:pt-20">+ <a href="/">+ <Layout.logo />+ </a>+ </div>++ <div class="max-w-md mx-auto mt-10 sm:mt-16 px-4 flex flex-col gap-y-2 text-center dark:text-gray-300">+ <h1 class="text-lg sm:text-xl font-semibold">+ {@heading}+ </h1>+ <p :if={@subtitle} class="text-base text-gray-500 dark:text-gray-400 text-pretty">+ {@subtitle}+ </p>+ </div>+ {render_slot(@inner_block)}+ </div>+ </.app>+ """+ endenddiff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.exindex c8bf9f7061..76974cf9da 100644--- a/lib/plausible_web/controllers/auth_controller.ex+++ b/lib/plausible_web/controllers/auth_controller.ex@@ -76,13 +76,14 @@ defmodule PlausibleWeb.AuthController dodefp render_activate_form(conn, flow, opts) doassigns =[+ legacy_layout?: false,error: nil,form_submit_url: "/activate?flow=#{flow}",team_identifier: conn.params["team_identifier"]]|> Keyword.merge(opts)- render_auth_page(+ render(conn,"activate.html",Keyword.put(assigns, :heading, activate_heading(assigns[:has_email_code?]))@@ -165,11 +166,14 @@ defmodule PlausibleWeb.AuthController doenddef password_reset_request_form(conn, _) do- render_password_reset_request_form(conn)+ render(conn, "password_reset_request_form.html", legacy_layout?: false)enddef password_reset_request(conn, %{"email" => ""}) do- render_password_reset_request_form(conn, error: "Please enter an email address")+ render(conn, "password_reset_request_form.html",+ legacy_layout?: false,+ error: "Please enter an email address"+ )enddef password_reset_request(conn, %{"email" => email} = params) do@@ -185,62 +189,48 @@ defmodule PlausibleWeb.AuthController do"Password reset e-mail sent. In dev environment GET /sent-emails for details.")- render_auth_page(conn, "password_reset_request_success.html",- heading: "Check your email",+ render(conn, "password_reset_request_success.html",+ legacy_layout?: false,email: email){:error, _} ->- render_auth_page(conn, "password_reset_request_success.html",- heading: "Check your email",+ render(conn, "password_reset_request_success.html",+ legacy_layout?: false,email: email)endelse- render_password_reset_request_form(conn,+ render(conn, "password_reset_request_form.html",+ legacy_layout?: false,captcha_error: "Please complete the captcha to reset your password")endend- defp render_password_reset_request_form(conn, extra_assigns \\ []) do- render_auth_page(- conn,- "password_reset_request_form.html",- Keyword.merge(- [- heading: "Reset your password",- subtitle: "Enter your email to receive a password reset link."- ],- extra_assigns- )- )- end-def password_reset_form(conn, params) docase Auth.Token.verify_password_reset(params["token"]) do{:ok, %{email: email}} ->- render_auth_page(conn, "password_reset_form.html",+ render(conn, "password_reset_form.html",+ legacy_layout?: false,connect_live_socket: true,- heading: "Reset your password",- subtitle: "Choose a new password for your account",email: email){:error, :expired} ->conn|> put_status(401)- |> render_auth_page("password_reset_error.html",- heading: "Password reset link expired",- subtitle: "Request a new one to reset your password."+ |> render("password_reset_error.html",+ legacy_layout?: false,+ heading: "Password reset link expired"){:error, _} ->conn|> put_status(401)- |> render_auth_page("password_reset_error.html",- heading: "Password reset link invalid",- subtitle: "Request a new one to reset your password."+ |> render("password_reset_error.html",+ legacy_layout?: false,+ heading: "Password reset link invalid")endend@@ -276,7 +266,11 @@ defmodule PlausibleWeb.AuthController doheading = Phoenix.Flash.get(conn.assigns.flash, :login_title) || "Sign in to your account"subtitle = Phoenix.Flash.get(conn.assigns.flash, :login_instructions)- render_auth_page(conn, "login_form.html", heading: heading, subtitle: subtitle)+ render(conn, "login_form.html",+ legacy_layout?: false,+ heading: heading,+ subtitle: subtitle+ )enddef login(conn, %{"user" => params}) do@@ -483,7 +477,7 @@ defmodule PlausibleWeb.AuthController docase TwoFactor.Session.get_2fa_user(conn) do{:ok, user} ->if Auth.TOTP.enabled?(user) do- render_verify_2fa(conn)+ render(conn, "verify_2fa.html", legacy_layout?: false, error: nil)elseredirect_to_login(conn)end@@ -504,7 +498,10 @@ defmodule PlausibleWeb.AuthController do{:error, :invalid_code} ->Auth.log_failed_login_attempt("wrong 2FA verification code provided for #{user.email}")- render_verify_2fa(conn, "The provided code is invalid. Please try again")+ render(conn, "verify_2fa.html",+ legacy_layout?: false,+ error: "The provided code is invalid. Please try again"+ ){:error, :not_enabled} ->UserAuth.log_in_user(conn, user, params["return_to"])@@ -516,7 +513,7 @@ defmodule PlausibleWeb.AuthController docase TwoFactor.Session.get_2fa_user(conn) do{:ok, user} ->if Auth.TOTP.enabled?(user) do- render_verify_2fa_recovery_code(conn)+ render(conn, "verify_2fa_recovery_code.html", legacy_layout?: false, error: nil)elseredirect_to_login(conn)end@@ -535,9 +532,9 @@ defmodule PlausibleWeb.AuthController do{:error, :invalid_code} ->Auth.log_failed_login_attempt("wrong 2FA recovery code provided for #{user.email}")- render_verify_2fa_recovery_code(- conn,- "The provided recovery code is invalid. Please try another one"+ render(conn, "verify_2fa_recovery_code.html",+ legacy_layout?: false,+ error: "The provided recovery code is invalid. Please try another one"){:error, :not_enabled} ->@@ -546,23 +543,6 @@ defmodule PlausibleWeb.AuthController doendend- defp render_verify_2fa(conn, error \\ nil) do- render_auth_page(conn, "verify_2fa.html",- error: error,- heading: "Enter your 2FA code",- subtitle: "Open your authenticator app and enter the 6-digit code.",- remember_2fa_days: TwoFactor.Session.remember_2fa_days()- )- end-- defp render_verify_2fa_recovery_code(conn, error \\ nil) do- render_auth_page(conn, "verify_2fa_recovery_code.html",- error: error,- heading: "Use a recovery code",- subtitle: "Enter one of your saved recovery codes to sign in."- )- end-defp get_2fa_user_limited(conn) docase TwoFactor.Session.get_2fa_user(conn) do{:ok, user} ->diff --git a/lib/plausible_web/controllers/helpers.ex b/lib/plausible_web/controllers/helpers.exindex 9a96e5e8a9..8d65e5ca6c 100644--- a/lib/plausible_web/controllers/helpers.ex+++ b/lib/plausible_web/controllers/helpers.ex@@ -23,17 +23,6 @@ defmodule PlausibleWeb.ControllerHelpers dodefp error_layout,do: Application.get_env(:plausible, PlausibleWeb.Endpoint)[:render_errors][:layout]- @auth_layout_assigns [- layout: {PlausibleWeb.LayoutView, :auth},- hide_header?: true,- hide_footer?: true,- disable_global_notices?: true- ]-- def render_auth_page(conn, template, extra_assigns \\ []) do- render(conn, template, Keyword.merge(@auth_layout_assigns, extra_assigns))- end-@onboarding_layout_assigns [layout: {PlausibleWeb.LayoutView, :onboarding},hide_footer?: true,diff --git a/lib/plausible_web/live/auth_layout_context.ex b/lib/plausible_web/live/auth_layout_context.exdeleted file mode 100644index 9edd326b18..0000000000--- a/lib/plausible_web/live/auth_layout_context.ex+++ /dev/null@@ -1,16 +0,0 @@-defmodule PlausibleWeb.Live.AuthLayoutContext do- @moduledoc false-- import Phoenix.Component-- def on_mount(_arg, _params, _session, socket) do- socket =- assign(socket,- hide_header?: true,- hide_footer?: true,- disable_global_notices?: true- )-- {:cont, socket, layout: {PlausibleWeb.LayoutView, :auth}}- end-enddiff --git a/lib/plausible_web/live/register_form.ex b/lib/plausible_web/live/register_form.exindex 9ab81f0c9f..4b71d67971 100644--- a/lib/plausible_web/live/register_form.ex+++ b/lib/plausible_web/live/register_form.ex@@ -8,10 +8,12 @@ defmodule PlausibleWeb.Live.RegisterForm doalias Plausible.Authalias Plausible.Repoalias Plausible.Teams+ alias PlausibleWeb.Layoutsdef mount(params, _session, socket) dosocket =socket+ |> assign(:legacy_layout?, false)|> assign_new(:invitation, fn ->if invitation_id = params["invitation_id"] dofind_by_id_unified(invitation_id)@@ -70,98 +72,102 @@ defmodule PlausibleWeb.Live.RegisterForm dodef render(%{invitation_expired: true} = assigns) do~H"""- <.auth_container class="flex gap-3 justify-center">- <.button_link href="/register" mt?={false}>- Start free trial- </.button_link>- <.button_link href="/login" theme="secondary" mt?={false}>- Sign in- </.button_link>- </.auth_container>+ <Layouts.auth heading={@heading} subtitle={@subtitle} flash={@flash}>+ <.auth_container class="flex gap-3 justify-center">+ <.button_link href="/register" mt?={false}>+ Start free trial+ </.button_link>+ <.button_link href="/login" theme="secondary" mt?={false}>+ Sign in+ </.button_link>+ </.auth_container>+ </Layouts.auth>"""enddef render(assigns) do~H"""- <.auth_container>- <.form- :let={f}- for={@form}- id="register-form"- class="flex flex-col gap-y-6"- action={Routes.auth_path(@socket, :login)}- onsubmit={form_submit_event(@invitation)}- phx-change="validate"- phx-submit="register"- phx-trigger-action={@trigger_submit}- >- <input name="user[register_action]" type="hidden" value={@live_action} />- <input- :if={@team_identifier}- name="user[team_identifier]"- type="hidden"- value={@team_identifier}- />+ <Layouts.auth heading={@heading} subtitle={@subtitle} flash={@flash}>+ <.auth_container>+ <.form+ :let={f}+ for={@form}+ id="register-form"+ class="flex flex-col gap-y-6"+ action={Routes.auth_path(@socket, :login)}+ onsubmit={form_submit_event(@invitation)}+ phx-change="validate"+ phx-submit="register"+ phx-trigger-action={@trigger_submit}+ >+ <input name="user[register_action]" type="hidden" value={@live_action} />+ <input+ :if={@team_identifier}+ name="user[team_identifier]"+ type="hidden"+ value={@team_identifier}+ />++ <%= if @invitation do %>+ <.email_input field={f[:email]} for_invitation={true} />+ <.name_input field={f[:name]} />+ <% else %>+ <.name_input field={f[:name]} />+ <.email_input field={f[:email]} for_invitation={false} />+ <% end %>++ <div class="flex flex-col gap-y-2">+ <label+ for={f[:password].id}+ class="text-sm font-semibold text-gray-800 dark:text-gray-200"+ >+ Password+ </label>+ <div>+ <.password_input_with_strength+ field={f[:password]}+ strength={@password_strength}+ phx-debounce={200}+ mt?={false}+ />+ </div>+ <.password_length_hint minimum={12} field={f[:password]} hide_when_used?={true} />+ </div>- <%= if @invitation do %>- <.email_input field={f[:email]} for_invitation={true} />- <.name_input field={f[:name]} />- <% else %>- <.name_input field={f[:name]} />- <.email_input field={f[:email]} for_invitation={false} />- <% end %>-- <div class="flex flex-col gap-y-2">- <label- for={f[:password].id}- class="text-sm font-semibold text-gray-800 dark:text-gray-200"- >- Password- </label>- <div>- <.password_input_with_strength- field={f[:password]}- strength={@password_strength}- phx-debounce={200}+ <%= if PlausibleWeb.Captcha.enabled?() do %>+ <PlausibleWeb.Components.Captcha.widget error={@captcha_error} />+ <% end %>++ <div class="flex flex-col gap-y-4">+ <% submit_text =+ if ce?() or @invitation do+ "Create my account"+ else+ "Start my free trial"+ end %>+ <.button+ id="register"+ type="submit"+ class="w-full"mt?={false}- />+ x-data={"{ captchaReady: #{not PlausibleWeb.Captcha.enabled?()} }"}+ x-on:frc-captcha-ready.window="captchaReady = true"+ x-on:frc-captcha-reset.window="captchaReady = false"+ x-bind:disabled={"!captchaReady || #{@disable_submit}"}+ >+ {submit_text}+ </.button>++ <p class="text-sm text-center text-gray-500 dark:text-gray-400">+ Already have an account?+ <.styled_link href="/login">+ Sign in+ </.styled_link>+ </p></div>- <.password_length_hint minimum={12} field={f[:password]} hide_when_used?={true} />- </div>-- <%= if PlausibleWeb.Captcha.enabled?() do %>- <PlausibleWeb.Components.Captcha.widget error={@captcha_error} />- <% end %>-- <div class="flex flex-col gap-y-4">- <% submit_text =- if ce?() or @invitation do- "Create my account"- else- "Start my free trial"- end %>- <.button- id="register"- type="submit"- class="w-full"- mt?={false}- x-data={"{ captchaReady: #{not PlausibleWeb.Captcha.enabled?()} }"}- x-on:frc-captcha-ready.window="captchaReady = true"- x-on:frc-captcha-reset.window="captchaReady = false"- x-bind:disabled={"!captchaReady || #{@disable_submit}"}- >- {submit_text}- </.button>-- <p class="text-sm text-center text-gray-500 dark:text-gray-400">- Already have an account?- <.styled_link href="/login">- Sign in- </.styled_link>- </p>- </div>- </.form>- </.auth_container>+ </.form>+ </.auth_container>+ </Layouts.auth>"""enddiff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.exindex 35e6c389bf..fd2c69f891 100644--- a/lib/plausible_web/router.ex+++ b/lib/plausible_web/router.ex@@ -438,23 +438,21 @@ defmodule PlausibleWeb.Router doscope alias: Live, assigns: %{connect_live_socket: true} dopipe_through [PlausibleWeb.RequireLoggedOutPlug, :app_layout]- live_session :auth, on_mount: PlausibleWeb.Live.AuthLayoutContext do- scope assigns: %{disable_registration_for: [:invite_only, true]} do- pipe_through PlausibleWeb.Plugs.MaybeDisableRegistration+ scope assigns: %{disable_registration_for: [:invite_only, true]} do+ pipe_through PlausibleWeb.Plugs.MaybeDisableRegistration- live "/register", RegisterForm, :register_form, as: :auth- end+ live "/register", RegisterForm, :register_form, as: :auth+ end- scope assigns: %{- disable_registration_for: true,- dogfood_page_path: "/register/invitation/:invitation_id"- } do- pipe_through PlausibleWeb.Plugs.MaybeDisableRegistration+ scope assigns: %{+ disable_registration_for: true,+ dogfood_page_path: "/register/invitation/:invitation_id"+ } do+ pipe_through PlausibleWeb.Plugs.MaybeDisableRegistration- live "/register/invitation/:invitation_id",- RegisterForm,- :register_from_invitation_form, as: :auth- end+ live "/register/invitation/:invitation_id",+ RegisterForm,+ :register_from_invitation_form, as: :authendenddiff --git a/lib/plausible_web/templates/auth/activate.html.heex b/lib/plausible_web/templates/auth/activate.html.heexindex 5fde7590df..67b61d6e01 100644--- a/lib/plausible_web/templates/auth/activate.html.heex+++ b/lib/plausible_web/templates/auth/activate.html.heex@@ -1,40 +1,79 @@-<p class="max-w-md mx-auto mt-2 px-4 text-base text-gray-500 dark:text-gray-400 text-center text-pretty">- <%= if @has_email_code? do %>- We've sent an email with your code to: <br />- <span class="font-semibold">{@conn.assigns[:current_user].email}</span>- <% else %>- We'll send a 4-digit activation code to: <br />- <span class="font-semibold">{@conn.assigns[:current_user].email}</span>- <% end %>-</p>+<Layouts.auth heading={@heading}>+ <p class="max-w-md mx-auto mt-2 px-4 text-base text-gray-500 dark:text-gray-400 text-center text-pretty">+ <%= if @has_email_code? do %>+ We've sent an email with your code to: <br />+ <span class="font-semibold">{@conn.assigns[:current_user].email}</span>+ <% else %>+ We'll send a 4-digit activation code to: <br />+ <span class="font-semibold">{@conn.assigns[:current_user].email}</span>+ <% end %>+ </p>-<.auth_container>- <%= if @has_email_code? do %>- <.form- :let={f}- for={@conn}- action={@form_submit_url}- class="flex flex-col gap-y-6"- >- <input type="hidden" name="team_identifier" value={@team_identifier} />+ <.auth_container>+ <%= if @has_email_code? do %>+ <.form+ :let={f}+ for={@conn}+ action={@form_submit_url}+ class="flex flex-col gap-y-6"+ >+ <input type="hidden" name="team_identifier" value={@team_identifier} />+ <div class="flex flex-col gap-y-2">+ <.otp_input field={f[:code]} length={4} autofocus="autofocus" />+ <p :if={@error} class="text-xs text-red-500 text-center">+ {@error}+ </p>+ </div>++ <.button type="submit" class="w-full" mt?={false}>+ Activate account+ </.button>+ </.form>++ <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">+ <p>+ Didn't receive it?+ <.styled_link href="/activate/request-code" method="post">Resend code</.styled_link>+ or+ <%= if @has_any_memberships? do %>+ <.styled_link method="post" href={Routes.settings_path(@conn, :cancel_update_email)}>+ use my previous email+ </.styled_link>+ <% else %>+ <.styled_link method="delete" href="/me?redirect=/register">+ change email+ </.styled_link>+ <% end %>+ </p>+ <p :if={ee?()}>+ Need help?+ <.styled_link href="https://plausible.io/contact" new_tab={true}>+ Contact us+ </.styled_link>+ </p>+ <p :if={ce?()}>+ Need help? Ask on our+ <.styled_link+ href="https://github.com/plausible/analytics/discussions"+ new_tab={true}+ >+ community forum+ </.styled_link>+ </p>+ </div>+ <% else %><div class="flex flex-col gap-y-2">- <.otp_input field={f[:code]} length={4} autofocus="autofocus" />+ <.button_link method="post" class="w-full" href="/activate/request-code">+ Send activation code+ </.button_link><p :if={@error} class="text-xs text-red-500 text-center">{@error}</p></div>- <.button type="submit" class="w-full" mt?={false}>- Activate account- </.button>- </.form>-- <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">- <p>- Didn't receive it?- <.styled_link href="/activate/request-code" method="post">Resend code</.styled_link>- or+ <p class="mt-6 text-sm text-gray-500 dark:text-gray-400 text-center">+ Wrong email?<%= if @has_any_memberships? do %><.styled_link method="post" href={Routes.settings_path(@conn, :cancel_update_email)}>use my previous email@@ -43,39 +82,6 @@<.styled_link method="delete" href="/me?redirect=/register">change email</.styled_link><% end %></p>- <p :if={ee?()}>- Need help?- <.styled_link href="https://plausible.io/contact" new_tab={true}>Contact us</.styled_link>- </p>- <p :if={ce?()}>- Need help? Ask on our- <.styled_link- href="https://github.com/plausible/analytics/discussions"- new_tab={true}- >- community forum- </.styled_link>- </p>- </div>- <% else %>- <div class="flex flex-col gap-y-2">- <.button_link method="post" class="w-full" href="/activate/request-code">- Send activation code- </.button_link>- <p :if={@error} class="text-xs text-red-500 text-center">- {@error}- </p>- </div>-- <p class="mt-6 text-sm text-gray-500 dark:text-gray-400 text-center">- Wrong email?- <%= if @has_any_memberships? do %>- <.styled_link method="post" href={Routes.settings_path(@conn, :cancel_update_email)}>- use my previous email- </.styled_link>- <% else %>- <.styled_link method="delete" href="/me?redirect=/register">change email</.styled_link>- <% end %>- </p>- <% end %>-</.auth_container>+ <% end %>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/login_form.html.heex b/lib/plausible_web/templates/auth/login_form.html.heexindex 2cf345f59a..24bceebcaf 100644--- a/lib/plausible_web/templates/auth/login_form.html.heex+++ b/lib/plausible_web/templates/auth/login_form.html.heex@@ -1,75 +1,80 @@-<.auth_container>- <.form :let={f} for={@conn} action="/login" class="flex flex-col gap-y-6">- <div class="flex flex-col gap-y-2">- <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">- </label>- <div>- <.input- type="email"- autocomplete="username"- placeholder="[email protected]"- field={f[:email]}+<Layouts.auth heading={@heading} subtitle={@subtitle}>+ <.auth_container>+ <.form :let={f} for={@conn} action="/login" class="flex flex-col gap-y-6">+ <div class="flex flex-col gap-y-2">+ <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">+ </label>+ <div>+ <.input+ type="email"+ autocomplete="username"+ placeholder="[email protected]"+ field={f[:email]}+ mt?={false}+ autofocus="autofocus"+ />+ </div>+ </div>++ <div class="relative flex flex-col gap-y-2">+ <label+ for="current-password"+ class="text-sm font-semibold text-gray-800 dark:text-gray-200"+ >+ Password+ </label>+ <.password_field+ id="current-password"+ autocomplete="current-password"+ field={f[:password]}mt?={false}- autofocus="autofocus"/>+ <.styled_link href="/password/request-reset" class="text-sm absolute top-0 right-0">+ Forgot password?+ </.styled_link>+ <p+ :if={login_error = Phoenix.Flash.get(@flash, :login_error)}+ class="text-xs text-red-500"+ >+ {login_error}+ </p></div>- </div>-- <div class="relative flex flex-col gap-y-2">- <label for="current-password" class="text-sm font-semibold text-gray-800 dark:text-gray-200">- Password- </label>- <.password_field- id="current-password"- autocomplete="current-password"- field={f[:password]}- mt?={false}- />- <.styled_link href="/password/request-reset" class="text-sm absolute top-0 right-0">- Forgot password?- </.styled_link>- <p- :if={login_error = Phoenix.Flash.get(@flash, :login_error)}- class="text-xs text-red-500"- >- {login_error}- </p>- </div>- <input type="hidden" name="return_to" value={@conn.params["return_to"]} />+ <input type="hidden" name="return_to" value={@conn.params["return_to"]} />- <div class="flex flex-col gap-y-6">- <.button class="w-full" type="submit">Sign in</.button>+ <div class="flex flex-col gap-y-6">+ <.button class="w-full" type="submit">Sign in</.button>- <div class="flex flex-col gap-y-2">- <p- :if={- Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) ==- false- }- class="text-sm text-center text-gray-500 dark:text-gray-400"- >- New here? <.styled_link href="/register">Create your account</.styled_link>- </p>+ <div class="flex flex-col gap-y-2">+ <p+ :if={+ Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) ==+ false+ }+ class="text-sm text-center text-gray-500 dark:text-gray-400"+ >+ New here? <.styled_link href="/register">Create your account</.styled_link>+ </p>- <%= on_ee do %>- <div class="flex items-center justify-center gap-x-1 text-sm text-gray-500 dark:text-gray-400">- <Heroicons.lock_closed class="size-3.5" />- <span>- Continue with- <.styled_link href={- Routes.sso_path(@conn, :login_form,- return_to: @conn.params["return_to"],- prefer: "manual"- )- }>- SSO- </.styled_link>- </span>- </div>- <% end %>+ <%= on_ee do %>+ <div class="flex items-center justify-center gap-x-1 text-sm text-gray-500 dark:text-gray-400">+ <Heroicons.lock_closed class="size-3.5" />+ <span>+ Continue with+ <.styled_link href={+ Routes.sso_path(@conn, :login_form,+ return_to: @conn.params["return_to"],+ prefer: "manual"+ )+ }>+ SSO+ </.styled_link>+ </span>+ </div>+ <% end %>+ </div></div>- </div>- </.form>-</.auth_container>+ </.form>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/password_reset_error.html.heex b/lib/plausible_web/templates/auth/password_reset_error.html.heexindex 2f88bb73e9..17bf23d154 100644--- a/lib/plausible_web/templates/auth/password_reset_error.html.heex+++ b/lib/plausible_web/templates/auth/password_reset_error.html.heex@@ -1,5 +1,7 @@-<.auth_container class="flex justify-center">- <.button_link href="/password/request-reset" mt?={false}>- Send new reset link- </.button_link>-</.auth_container>+<Layouts.auth heading={@heading} subtitle="Request a new one to reset your password.">+ <.auth_container class="flex justify-center">+ <.button_link href="/password/request-reset" mt?={false}>+ Send new reset link+ </.button_link>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/password_reset_form.html.heex b/lib/plausible_web/templates/auth/password_reset_form.html.heexindex 1cd078c299..398d9612e2 100644--- a/lib/plausible_web/templates/auth/password_reset_form.html.heex+++ b/lib/plausible_web/templates/auth/password_reset_form.html.heex@@ -1,6 +1,11 @@-<.auth_container>- {live_render(@conn, PlausibleWeb.Live.ResetPasswordForm,- container: {:div, class: "contents"},- session: %{"email" => @email}- )}-</.auth_container>+<Layouts.auth+ heading="Reset your password"+ subtitle="Choose a new password for your account"+>+ <.auth_container>+ {live_render(@conn, PlausibleWeb.Live.ResetPasswordForm,+ container: {:div, class: "contents"},+ session: %{"email" => @email}+ )}+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/password_reset_request_form.html.heex b/lib/plausible_web/templates/auth/password_reset_request_form.html.heexindex 14d7d22b09..22aa7c7fd2 100644--- a/lib/plausible_web/templates/auth/password_reset_request_form.html.heex+++ b/lib/plausible_web/templates/auth/password_reset_request_form.html.heex@@ -1,49 +1,54 @@-<.auth_container>- <.form- :let={f}- for={@conn}- action={Routes.auth_path(@conn, :password_reset_request)}- class="flex flex-col gap-y-6"- >- <div class="flex flex-col gap-y-2">- <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">- </label>- <div>- <.input- type="email"- autocomplete="username"- placeholder="[email protected]"- field={f[:email]}- mt?={false}- autofocus="autofocus"- />+<Layouts.auth+ heading="Reset your password"+ subtitle="Enter your email to receive a password reset link."+>+ <.auth_container>+ <.form+ :let={f}+ for={@conn}+ action={Routes.auth_path(@conn, :password_reset_request)}+ class="flex flex-col gap-y-6"+ >+ <div class="flex flex-col gap-y-2">+ <label for={f[:email].id} class="text-sm font-semibold text-gray-800 dark:text-gray-200">+ </label>+ <div>+ <.input+ type="email"+ autocomplete="username"+ placeholder="[email protected]"+ field={f[:email]}+ mt?={false}+ autofocus="autofocus"+ />+ </div>+ <p :if={@conn.assigns[:error]} class="text-xs text-red-500">+ {@conn.assigns[:error]}+ </p></div>- <p :if={@conn.assigns[:error]} class="text-xs text-red-500">- {@conn.assigns[:error]}- </p>- </div>- <%= if PlausibleWeb.Captcha.enabled?() do %>- <PlausibleWeb.Components.Captcha.widget error={assigns[:captcha_error]} />- <% end %>+ <%= if PlausibleWeb.Captcha.enabled?() do %>+ <PlausibleWeb.Components.Captcha.widget error={assigns[:captcha_error]} />+ <% end %>- <div class="flex flex-col gap-y-4">- <.button- class="w-full"- type="submit"- mt?={false}- x-data={"{ captchaReady: #{not PlausibleWeb.Captcha.enabled?()} }"}- x-on:frc-captcha-ready.window="captchaReady = true"- x-on:frc-captcha-reset.window="captchaReady = false"- x-bind:disabled="!captchaReady"- >- Send reset link- </.button>+ <div class="flex flex-col gap-y-4">+ <.button+ class="w-full"+ type="submit"+ mt?={false}+ x-data={"{ captchaReady: #{not PlausibleWeb.Captcha.enabled?()} }"}+ x-on:frc-captcha-ready.window="captchaReady = true"+ x-on:frc-captcha-reset.window="captchaReady = false"+ x-bind:disabled="!captchaReady"+ >+ Send reset link+ </.button>- <p class="text-sm text-center text-gray-500 dark:text-gray-400">- <.styled_link href="/login">Back to sign in</.styled_link>- </p>- </div>- </.form>-</.auth_container>+ <p class="text-sm text-center text-gray-500 dark:text-gray-400">+ <.styled_link href="/login">Back to sign in</.styled_link>+ </p>+ </div>+ </.form>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/password_reset_request_success.html.heex b/lib/plausible_web/templates/auth/password_reset_request_success.html.heexindex 48c11ab07e..8f7963a0c6 100644--- a/lib/plausible_web/templates/auth/password_reset_request_success.html.heex+++ b/lib/plausible_web/templates/auth/password_reset_request_success.html.heex@@ -1,27 +1,29 @@-<p class="max-w-md mx-auto mt-2 px-4 text-base text-gray-500 dark:text-gray-400 text-center">- If an account exists for <span class="font-semibold">{@email}</span>, we've sent a password reset email.-</p>+<Layouts.auth heading="Check your email">+ <p class="max-w-md mx-auto mt-2 px-4 text-base text-gray-500 dark:text-gray-400 text-center">+ If an account exists for <span class="font-semibold">{@email}</span>, we've sent a password reset email.+ </p>-<.auth_container class="border-t border-gray-200 dark:border-gray-700 pt-10">- <div class="flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">- <p class="font-semibold">- Didn't receive the email?- </p>- <p :if={ee?()}>- It may take a few minutes to arrive. Check your spam folder or try again with the email address associated with your account. Still no email? <.styled_link- href="https://plausible.io/contact"- new_tab={true}- >Contact us</.styled_link>.- </p>- <p :if={ce?()}>- It may take a few minutes to arrive. Check your spam folder or try again with the email address associated with your account. Still no email? Ask on our <.styled_link- href="https://github.com/plausible/analytics/discussions"- new_tab={true}- >community forum</.styled_link>.- </p>- </div>+ <.auth_container class="border-t border-gray-200 dark:border-gray-700 pt-10">+ <div class="flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">+ <p class="font-semibold">+ Didn't receive the email?+ </p>+ <p :if={ee?()}>+ It may take a few minutes to arrive. Check your spam folder or try again with the email address associated with your account. Still no email? <.styled_link+ href="https://plausible.io/contact"+ new_tab={true}+ >Contact us</.styled_link>.+ </p>+ <p :if={ce?()}>+ It may take a few minutes to arrive. Check your spam folder or try again with the email address associated with your account. Still no email? Ask on our <.styled_link+ href="https://github.com/plausible/analytics/discussions"+ new_tab={true}+ >community forum</.styled_link>.+ </p>+ </div>- <p class="mt-10 text-sm text-center text-gray-500 dark:text-gray-400">- <.styled_link href="/login">Back to sign in</.styled_link>- </p>-</.auth_container>+ <p class="mt-10 text-sm text-center text-gray-500 dark:text-gray-400">+ <.styled_link href="/login">Back to sign in</.styled_link>+ </p>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/verify_2fa.html.heex b/lib/plausible_web/templates/auth/verify_2fa.html.heexindex a4f97136d5..ad59e8a5bc 100644--- a/lib/plausible_web/templates/auth/verify_2fa.html.heex+++ b/lib/plausible_web/templates/auth/verify_2fa.html.heex@@ -1,45 +1,50 @@-<.auth_container>- <.form- :let={f}- action={Routes.auth_path(@conn, :verify_2fa, Map.take(@conn.query_params, ["return_to"]))}- for={@conn.params}- class="flex flex-col gap-y-6"- onsubmit="document.getElementById('verify-button').disabled = true"- >- <PlausibleWeb.Components.TwoFactor.verify_2fa_input- form={f}- field={:code}- class=""- autofocus?={true}- error={@error}- />-- <div class="flex justify-center items-center">- <.input- type="checkbox"- field={f[:remember_2fa]}- value="true"- label={"Remember this device for #{@remember_2fa_days} days"}- mt?={false}- class="block size-5 rounded-sm dark:bg-gray-700 border-gray-300 text-indigo-600 focus:ring-indigo-600"+<Layouts.auth+ heading="Enter your 2FA code"+ subtitle="Open your authenticator app and enter the 6-digit code."+>+ <.auth_container>+ <.form+ :let={f}+ action={Routes.auth_path(@conn, :verify_2fa, Map.take(@conn.query_params, ["return_to"]))}+ for={@conn.params}+ class="flex flex-col gap-y-6"+ onsubmit="document.getElementById('verify-button').disabled = true"+ >+ <PlausibleWeb.Components.TwoFactor.verify_2fa_input+ form={f}+ field={:code}+ class=""+ autofocus?={true}+ error={@error}/>- </div>- <.input type="hidden" field={f[:return_to]} mt?={false} />- </.form>+ <div class="flex justify-center items-center">+ <.input+ type="checkbox"+ field={f[:remember_2fa]}+ value="true"+ label={"Remember this device for #{PlausibleWeb.TwoFactor.Session.remember_2fa_days()} days"}+ mt?={false}+ class="block size-5 rounded-sm dark:bg-gray-700 border-gray-300 text-indigo-600 focus:ring-indigo-600"+ />+ </div>- <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">- <p>- Can't access your authenticator app?- <.styled_link href={Routes.auth_path(@conn, :verify_2fa_recovery_code_form)}>- Use a recovery code- </.styled_link>- </p>- <p :if={ee?()}>- Need help?- <.styled_link href="https://plausible.io/contact">- Contact us- </.styled_link>- </p>- </div>-</.auth_container>+ <.input type="hidden" field={f[:return_to]} mt?={false} />+ </.form>++ <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">+ <p>+ Can't access your authenticator app?+ <.styled_link href={Routes.auth_path(@conn, :verify_2fa_recovery_code_form)}>+ Use a recovery code+ </.styled_link>+ </p>+ <p :if={ee?()}>+ Need help?+ <.styled_link href="https://plausible.io/contact">+ Contact us+ </.styled_link>+ </p>+ </div>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex b/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heexindex 99dde815cf..6e5d1c784d 100644--- a/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex+++ b/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex@@ -1,54 +1,60 @@-<.auth_container>- <.form- :let={f}- for={@conn.params}- action={Routes.auth_path(@conn, :verify_2fa_recovery_code)}- class="flex flex-col gap-y-6"- onsubmit="document.getElementById('use-code-button').disabled = true"- >- <div class="flex flex-col gap-y-2">- <.input- type="text"- field={f[:recovery_code]}- autocomplete="off"- autofocus="autofocus"- maxlength="10"- oninvalid="document.getElementById('use-code-button').disabled = false"- required="required"- placeholder="Recovery code"+<Layouts.auth+ heading="Use a recovery code"+ subtitle="Enter one of your saved recovery codes to sign in."+>+ <.auth_container>+ <.form+ :let={f}+ for={@conn.params}+ action={Routes.auth_path(@conn, :verify_2fa_recovery_code)}+ class="flex flex-col gap-y-6"+ onsubmit="document.getElementById('use-code-button').disabled = true"+ >+ <div class="flex flex-col gap-y-2">+ <.input+ type="text"+ field={f[:recovery_code]}+ autocomplete="off"+ autofocus="autofocus"+ maxlength="10"+ oninvalid="document.getElementById('use-code-button').disabled = false"+ required="required"+ placeholder="Recovery code"+ mt?={false}+ />+ <p :if={@error} class="text-xs text-red-500 text-center">+ {@error}+ </p>+ </div>++ <.button+ id="use-code-button"+ type="submit"mt?={false}- />- <p :if={@error} class="text-xs text-red-500 text-center">- {@error}+ class="w-full [&>span.label-enabled]:block [&>span.label-disabled]:hidden [&[disabled]>span.label-enabled]:hidden [&[disabled]>span.label-disabled]:block"+ >+ <span class="label-enabled pointer-events-none">+ Verify+ </span>+ <span class="label-disabled">+ <.spinner class="inline-block h-5 w-5 mr-2 text-white dark:text-gray-400" />+ Verifying...+ </span>+ </.button>+ </.form>++ <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">+ <p>+ <.styled_link href={Routes.auth_path(@conn, :verify_2fa)}>+ Use authenticator app instead+ </.styled_link>+ </p>+ <p :if={ee?()}>+ Lost your recovery codes?+ <.styled_link href="https://plausible.io/contact">+ Contact us+ </.styled_link></p></div>-- <.button- id="use-code-button"- type="submit"- mt?={false}- class="w-full [&>span.label-enabled]:block [&>span.label-disabled]:hidden [&[disabled]>span.label-enabled]:hidden [&[disabled]>span.label-disabled]:block"- >- <span class="label-enabled pointer-events-none">- Verify- </span>- <span class="label-disabled">- <.spinner class="inline-block h-5 w-5 mr-2 text-white dark:text-gray-400" /> Verifying...- </span>- </.button>- </.form>-- <div class="mt-6 flex flex-col gap-y-2 text-sm text-gray-500 dark:text-gray-400 text-center">- <p>- <.styled_link href={Routes.auth_path(@conn, :verify_2fa)}>- Use authenticator app instead- </.styled_link>- </p>- <p :if={ee?()}>- Lost your recovery codes?- <.styled_link href="https://plausible.io/contact">- Contact us- </.styled_link>- </p>- </div>-</.auth_container>+ </.auth_container>+</Layouts.auth>diff --git a/lib/plausible_web/templates/layout/app.html.heex b/lib/plausible_web/templates/layout/app.html.heexindex 1447e4af45..086dbcf99f 100644--- a/lib/plausible_web/templates/layout/app.html.heex+++ b/lib/plausible_web/templates/layout/app.html.heex@@ -29,11 +29,18 @@{render("_tracking.html", assigns)}</head><body- class={assigns[:bg_class] || "bg-gray-50 dark:bg-gray-950"}+ class={[+ if(!assigns[:embedded], do: "h-full"),+ assigns[:bg_class] || "bg-gray-50 dark:bg-gray-950"+ ]}style={if assigns[:background], do: "background-color: #{assigns[:background]}"}>- <Layouts.legacy {assigns}>+ <%= if Map.get(assigns, :legacy_layout?, true) do %>+ <Layouts.legacy {assigns}>+ {@inner_content}+ </Layouts.legacy>+ <% else %>{@inner_content}- </Layouts.legacy>+ <% end %></body></html>diff --git a/lib/plausible_web/templates/layout/auth.html.heex b/lib/plausible_web/templates/layout/auth.html.heexdeleted file mode 100644index 4a90d74d1b..0000000000--- a/lib/plausible_web/templates/layout/auth.html.heex+++ /dev/null@@ -1,18 +0,0 @@-<div class="min-h-screen w-full bg-white dark:bg-gray-900">- <div class="flex justify-center pt-12 sm:pt-20">- <a href="/">- <Layout.logo />- </a>- </div>-- <div class="max-w-md mx-auto mt-10 sm:mt-16 px-4 flex flex-col gap-y-2 text-center dark:text-gray-300">- <h1 class="text-lg sm:text-xl font-semibold">- {@heading}- </h1>- <p :if={assigns[:subtitle]} class="text-base text-gray-500 dark:text-gray-400 text-pretty">- {@subtitle}- </p>- </div>-- {@inner_content}-</div>diff --git a/lib/plausible_web/views/auth_view.ex b/lib/plausible_web/views/auth_view.exindex 23bc2d2c0e..29b4497cef 100644--- a/lib/plausible_web/views/auth_view.ex+++ b/lib/plausible_web/views/auth_view.ex@@ -2,6 +2,7 @@ defmodule PlausibleWeb.AuthView douse Plausibleuse PlausibleWeb, :viewalias Plausible.Billing.Plans+ alias PlausibleWeb.Layoutsdef subscription_quota(subscription, options \\ [])