forked from shibao/cannery
		
	rename page path to home path
This commit is contained in:
		@@ -27,21 +27,21 @@ defmodule Lokal.Email do
 | 
			
		||||
  @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t()
 | 
			
		||||
  def generate_email("welcome", user, %{"url" => url}) do
 | 
			
		||||
    user
 | 
			
		||||
    |> base_email(dgettext("emails", "Confirm your %{name} account", name: "Lokal"))
 | 
			
		||||
    |> base_email(dgettext("emails", "Confirm your Lokal account"))
 | 
			
		||||
    |> render_body("confirm_email.html", %{user: user, url: url})
 | 
			
		||||
    |> text_body(EmailView.render("confirm_email.txt", %{user: user, url: url}))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def generate_email("reset_password", user, %{"url" => url}) do
 | 
			
		||||
    user
 | 
			
		||||
    |> base_email(dgettext("emails", "Reset your %{name} password", name: "Lokal"))
 | 
			
		||||
    |> base_email(dgettext("emails", "Reset your Lokal password"))
 | 
			
		||||
    |> render_body("reset_password.html", %{user: user, url: url})
 | 
			
		||||
    |> text_body(EmailView.render("reset_password.txt", %{user: user, url: url}))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def generate_email("update_email", user, %{"url" => url}) do
 | 
			
		||||
    user
 | 
			
		||||
    |> base_email(dgettext("emails", "Update your %{name} email", name: "Lokal"))
 | 
			
		||||
    |> base_email(dgettext("emails", "Update your Lokal email"))
 | 
			
		||||
    |> render_body("update_email.html", %{user: user, url: url})
 | 
			
		||||
    |> text_body(EmailView.render("update_email.txt", %{user: user, url: url}))
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ defmodule LokalWeb.Components.Topbar do
 | 
			
		||||
  use LokalWeb, :component
 | 
			
		||||
 | 
			
		||||
  alias Lokal.Accounts
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
 | 
			
		||||
  def topbar(assigns) do
 | 
			
		||||
    assigns =
 | 
			
		||||
@@ -17,7 +17,7 @@ defmodule LokalWeb.Components.Topbar do
 | 
			
		||||
      <div class="flex flex-col sm:flex-row justify-between items-center">
 | 
			
		||||
        <div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
 | 
			
		||||
          <%= live_redirect("Lokal",
 | 
			
		||||
            to: Routes.live_path(Endpoint, PageLive),
 | 
			
		||||
            to: Routes.live_path(Endpoint, HomeLive),
 | 
			
		||||
            class: "mx-2 my-1 leading-5 text-xl text-white hover:underline"
 | 
			
		||||
          ) %>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,8 @@
 | 
			
		||||
defmodule LokalWeb.PageController do
 | 
			
		||||
defmodule LokalWeb.HomeController do
 | 
			
		||||
  @moduledoc """
 | 
			
		||||
  Controller for home page
 | 
			
		||||
  """
 | 
			
		||||
 | 
			
		||||
  use LokalWeb, :controller
 | 
			
		||||
 | 
			
		||||
  def index(conn, _params) do
 | 
			
		||||
@@ -7,7 +7,7 @@ defmodule LokalWeb.UserAuth do
 | 
			
		||||
  import Phoenix.Controller
 | 
			
		||||
  import LokalWeb.Gettext
 | 
			
		||||
  alias Lokal.{Accounts, Accounts.User}
 | 
			
		||||
  alias LokalWeb.PageLive
 | 
			
		||||
  alias LokalWeb.HomeLive
 | 
			
		||||
  alias LokalWeb.Router.Helpers, as: Routes
 | 
			
		||||
 | 
			
		||||
  # Make the remember me cookie valid for 60 days.
 | 
			
		||||
@@ -176,7 +176,7 @@ defmodule LokalWeb.UserAuth do
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "You are not authorized to view this page."))
 | 
			
		||||
      |> maybe_store_return_to()
 | 
			
		||||
      |> redirect(to: Routes.live_path(conn, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(conn, HomeLive))
 | 
			
		||||
      |> halt()
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ defmodule LokalWeb.UserRegistrationController do
 | 
			
		||||
  import LokalWeb.Gettext
 | 
			
		||||
  alias Lokal.{Accounts, Invites}
 | 
			
		||||
  alias Lokal.Accounts.User
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
 | 
			
		||||
  def new(conn, %{"invite" => invite_token}) do
 | 
			
		||||
    invite = Invites.get_invite_by_token(invite_token)
 | 
			
		||||
@@ -13,7 +13,7 @@ defmodule LokalWeb.UserRegistrationController do
 | 
			
		||||
    else
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, HomeLive))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +23,7 @@ defmodule LokalWeb.UserRegistrationController do
 | 
			
		||||
    else
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled"))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, HomeLive))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -44,7 +44,7 @@ defmodule LokalWeb.UserRegistrationController do
 | 
			
		||||
    else
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "Sorry, this invite was not found or expired"))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, HomeLive))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -54,7 +54,7 @@ defmodule LokalWeb.UserRegistrationController do
 | 
			
		||||
    else
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "Sorry, public registration is disabled"))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(Endpoint, HomeLive))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ defmodule LokalWeb.UserSettingsController do
 | 
			
		||||
  use LokalWeb, :controller
 | 
			
		||||
  import LokalWeb.Gettext
 | 
			
		||||
  alias Lokal.Accounts
 | 
			
		||||
  alias LokalWeb.{PageLive, UserAuth}
 | 
			
		||||
  alias LokalWeb.{HomeLive, UserAuth}
 | 
			
		||||
 | 
			
		||||
  plug :assign_email_and_password_changesets
 | 
			
		||||
 | 
			
		||||
@@ -93,7 +93,7 @@ defmodule LokalWeb.UserSettingsController do
 | 
			
		||||
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("prompts", "Your account has been deleted"))
 | 
			
		||||
      |> redirect(to: Routes.live_path(conn, PageLive))
 | 
			
		||||
      |> redirect(to: Routes.live_path(conn, HomeLive))
 | 
			
		||||
    else
 | 
			
		||||
      conn
 | 
			
		||||
      |> put_flash(:error, dgettext("errors", "Unable to delete user"))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
defmodule LokalWeb.PageLive do
 | 
			
		||||
defmodule LokalWeb.HomeLive do
 | 
			
		||||
  @moduledoc """
 | 
			
		||||
  Liveview for the main home page
 | 
			
		||||
  """
 | 
			
		||||
@@ -38,7 +38,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
 | 
			
		||||
    socket =
 | 
			
		||||
      case invite |> Invites.update_invite(invite_params, current_user) do
 | 
			
		||||
        {:ok, %{name: invite_name}} ->
 | 
			
		||||
          prompt = dgettext("prompts", "%{name} updated successfully", name: invite_name)
 | 
			
		||||
          prompt =
 | 
			
		||||
            dgettext("prompts", "%{invite_name} updated successfully", invite_name: invite_name)
 | 
			
		||||
 | 
			
		||||
          socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
 | 
			
		||||
 | 
			
		||||
        {:error, %Changeset{} = changeset} ->
 | 
			
		||||
@@ -56,7 +58,9 @@ defmodule LokalWeb.InviteLive.FormComponent do
 | 
			
		||||
    socket =
 | 
			
		||||
      case current_user |> Invites.create_invite(invite_params) do
 | 
			
		||||
        {:ok, %{name: invite_name}} ->
 | 
			
		||||
          prompt = dgettext("prompts", "%{name} created successfully", name: invite_name)
 | 
			
		||||
          prompt =
 | 
			
		||||
            dgettext("prompts", "%{invite_name} created successfully", invite_name: invite_name)
 | 
			
		||||
 | 
			
		||||
          socket |> put_flash(:info, prompt) |> push_redirect(to: return_to)
 | 
			
		||||
 | 
			
		||||
        {:error, %Changeset{} = changeset} ->
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
  use LokalWeb, :live_view
 | 
			
		||||
  import LokalWeb.Components.{InviteCard, UserCard}
 | 
			
		||||
  alias Lokal.{Accounts, Invites, Invites.Invite}
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
  alias Phoenix.LiveView.JS
 | 
			
		||||
 | 
			
		||||
  @impl true
 | 
			
		||||
@@ -16,7 +16,7 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
        socket |> display_invites()
 | 
			
		||||
      else
 | 
			
		||||
        prompt = dgettext("errors", "You are not authorized to view this page")
 | 
			
		||||
        return_to = Routes.live_path(Endpoint, PageLive)
 | 
			
		||||
        return_to = Routes.live_path(Endpoint, HomeLive)
 | 
			
		||||
        socket |> put_flash(:error, prompt) |> push_redirect(to: return_to)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
@@ -50,7 +50,7 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
    %{name: invite_name} =
 | 
			
		||||
      id |> Invites.get_invite!(current_user) |> Invites.delete_invite!(current_user)
 | 
			
		||||
 | 
			
		||||
    prompt = dgettext("prompts", "%{name} deleted succesfully", name: invite_name)
 | 
			
		||||
    prompt = dgettext("prompts", "%{invite_name} deleted succesfully", invite_name: invite_name)
 | 
			
		||||
    {:noreply, socket |> put_flash(:info, prompt) |> display_invites()}
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +64,9 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
      |> Invites.update_invite(%{"uses_left" => nil}, current_user)
 | 
			
		||||
      |> case do
 | 
			
		||||
        {:ok, %{name: invite_name}} ->
 | 
			
		||||
          prompt = dgettext("prompts", "%{name} updated succesfully", name: invite_name)
 | 
			
		||||
          prompt =
 | 
			
		||||
            dgettext("prompts", "%{invite_name} updated succesfully", invite_name: invite_name)
 | 
			
		||||
 | 
			
		||||
          socket |> put_flash(:info, prompt) |> display_invites()
 | 
			
		||||
 | 
			
		||||
        {:error, changeset} ->
 | 
			
		||||
@@ -84,7 +86,9 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
      |> Invites.update_invite(%{"uses_left" => nil, "disabled_at" => nil}, current_user)
 | 
			
		||||
      |> case do
 | 
			
		||||
        {:ok, %{name: invite_name}} ->
 | 
			
		||||
          prompt = dgettext("prompts", "%{name} enabled succesfully", name: invite_name)
 | 
			
		||||
          prompt =
 | 
			
		||||
            dgettext("prompts", "%{invite_name} enabled succesfully", invite_name: invite_name)
 | 
			
		||||
 | 
			
		||||
          socket |> put_flash(:info, prompt) |> display_invites()
 | 
			
		||||
 | 
			
		||||
        {:error, changeset} ->
 | 
			
		||||
@@ -106,7 +110,9 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
      |> Invites.update_invite(%{"uses_left" => 0, "disabled_at" => now}, current_user)
 | 
			
		||||
      |> case do
 | 
			
		||||
        {:ok, %{name: invite_name}} ->
 | 
			
		||||
          prompt = dgettext("prompts", "%{name} disabled succesfully", name: invite_name)
 | 
			
		||||
          prompt =
 | 
			
		||||
            dgettext("prompts", "%{invite_name} disabled succesfully", invite_name: invite_name)
 | 
			
		||||
 | 
			
		||||
          socket |> put_flash(:info, prompt) |> display_invites()
 | 
			
		||||
 | 
			
		||||
        {:error, changeset} ->
 | 
			
		||||
@@ -130,7 +136,7 @@ defmodule LokalWeb.InviteLive.Index do
 | 
			
		||||
      ) do
 | 
			
		||||
    %{email: user_email} = Accounts.get_user!(id) |> Accounts.delete_user!(current_user)
 | 
			
		||||
 | 
			
		||||
    prompt = dgettext("prompts", "%{name} deleted succesfully", name: user_email)
 | 
			
		||||
    prompt = dgettext("prompts", "%{user_email} deleted succesfully", user_email: user_email)
 | 
			
		||||
 | 
			
		||||
    {:noreply, socket |> put_flash(:info, prompt) |> display_invites()}
 | 
			
		||||
  end
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,8 @@
 | 
			
		||||
             phx_value_id: invite.id,
 | 
			
		||||
             data: [
 | 
			
		||||
               confirm:
 | 
			
		||||
                 dgettext("prompts", "Are you sure you want to delete the invite for %{name}?",
 | 
			
		||||
                   name: invite.name
 | 
			
		||||
                 dgettext("prompts", "Are you sure you want to delete the invite for %{invite_name}?",
 | 
			
		||||
                   invite_name: invite.name
 | 
			
		||||
                 ),
 | 
			
		||||
               qa: "delete-#{invite.id}"
 | 
			
		||||
             ] do %>
 | 
			
		||||
@@ -70,8 +70,8 @@
 | 
			
		||||
            phx-click="set_unlimited"
 | 
			
		||||
            phx-value-id={invite.id}
 | 
			
		||||
            data-confirm={
 | 
			
		||||
              dgettext("prompts", "Are you sure you want to make %{name} unlimited?",
 | 
			
		||||
                name: invite.name
 | 
			
		||||
              dgettext("prompts", "Are you sure you want to make %{invite_name} unlimited?",
 | 
			
		||||
                invite_name: invite.name
 | 
			
		||||
              )
 | 
			
		||||
            }
 | 
			
		||||
          >
 | 
			
		||||
 
 | 
			
		||||
@@ -35,7 +35,7 @@ defmodule LokalWeb.Router do
 | 
			
		||||
  scope "/", LokalWeb do
 | 
			
		||||
    pipe_through :browser
 | 
			
		||||
 | 
			
		||||
    live "/", PageLive
 | 
			
		||||
    live "/", HomeLive
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  ## Authentication routes
 | 
			
		||||
 
 | 
			
		||||
@@ -3,23 +3,21 @@
 | 
			
		||||
    <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
 | 
			
		||||
  </span>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <span style="margin-bottom: 1em; font-size: 1.25em;">
 | 
			
		||||
    <%= dgettext("emails", "Welcome to %{name}!", name: "Lokal") %>
 | 
			
		||||
    <%= dgettext("emails", "Welcome to Lokal") %>
 | 
			
		||||
  </span>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a>
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails",
 | 
			
		||||
    "If you didn't create an account at %{name}, please ignore this.",
 | 
			
		||||
    name: "Lokal") %>
 | 
			
		||||
  <%= dgettext("emails", "If you didn't create an account at Lokal, please ignore this.") %>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails", "Hi %{email},", email: @user.email) %>
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails", "Welcome to %{name}%!", name: "Lokal") %>
 | 
			
		||||
<%= dgettext("emails", "Welcome to Lokal") %>
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>
 | 
			
		||||
 | 
			
		||||
@@ -9,4 +9,4 @@
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails",
 | 
			
		||||
  "If you didn't create an account at %{url}, please ignore this.",
 | 
			
		||||
  url: Routes.live_url(Endpoint, PageLive)) %>
 | 
			
		||||
  url: Routes.live_url(Endpoint, HomeLive)) %>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,17 +3,15 @@
 | 
			
		||||
    <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
 | 
			
		||||
  </span>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails", "You can reset your password by visiting the URL below:") %>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a>
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails",
 | 
			
		||||
    "If you didn't request this change from %{name}, please ignore this.",
 | 
			
		||||
    name: "Lokal") %>
 | 
			
		||||
  <%= dgettext("emails", "If you didn't request this change from Lokal, please ignore this.") %>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -7,4 +7,4 @@
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails",
 | 
			
		||||
  "If you didn't request this change from %{url}, please ignore this.",
 | 
			
		||||
  url: Routes.live_url(Endpoint, PageLive)) %>
 | 
			
		||||
  url: Routes.live_url(Endpoint, HomeLive)) %>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,17 +3,18 @@
 | 
			
		||||
    <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
 | 
			
		||||
  </span>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails", "You can change your email by visiting the URL below:") %>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href="<%= @url %>"><%= @url %></a>
 | 
			
		||||
  <a style="margin: 1em; color: rgb(31, 31, 31);" href={@url}><%= @url %></a>
 | 
			
		||||
 | 
			
		||||
  <br/>
 | 
			
		||||
  <br />
 | 
			
		||||
 | 
			
		||||
  <%= dgettext("emails",
 | 
			
		||||
    "If you didn't request this change from %{name}, please ignore this.",
 | 
			
		||||
    name: "Lokal") %>
 | 
			
		||||
  <%= dgettext(
 | 
			
		||||
    "emails",
 | 
			
		||||
    "If you didn't request this change from Lokal, please ignore this."
 | 
			
		||||
  ) %>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -7,4 +7,4 @@
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails",
 | 
			
		||||
  "If you didn't request this change from %{url}, please ignore this.",
 | 
			
		||||
  url: Routes.live_url(Endpoint, PageLive)) %>
 | 
			
		||||
  url: Routes.live_url(Endpoint, HomeLive)) %>
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
 | 
			
		||||
        <hr class="w-full hr" />
 | 
			
		||||
 | 
			
		||||
        <a href={Routes.live_path(Endpoint, PageLive)} class="link title text-primary-600 text-lg">
 | 
			
		||||
        <a href={Routes.live_path(Endpoint, HomeLive)} class="link title text-primary-600 text-lg">
 | 
			
		||||
          <%= dgettext("errors", "Go back home") %>
 | 
			
		||||
        </a>
 | 
			
		||||
      </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,11 +9,10 @@
 | 
			
		||||
 | 
			
		||||
    <hr style="margin: 2em auto; border-width: 1px; border-color: rgb(212, 212, 216); width: 100%; max-width: 42rem;" />
 | 
			
		||||
 | 
			
		||||
    <a style="color: rgb(31, 31, 31);" href={Routes.live_url(Endpoint, PageLive)}>
 | 
			
		||||
    <a style="color: rgb(31, 31, 31);" href={Routes.live_url(Endpoint, HomeLive)}>
 | 
			
		||||
      <%= dgettext(
 | 
			
		||||
        "emails",
 | 
			
		||||
        "This email was sent from %{name}, the self-hosted firearm tracker website.",
 | 
			
		||||
        name: "Lokal"
 | 
			
		||||
        "This email was sent from Lokal, the self-hosted firearm tracker website."
 | 
			
		||||
      ) %>
 | 
			
		||||
    </a>
 | 
			
		||||
  </body>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,5 @@
 | 
			
		||||
=====================
 | 
			
		||||
 | 
			
		||||
<%= dgettext("emails",
 | 
			
		||||
  "This email was sent from %{name} at %{url}, the self-hosted firearm tracker website.",
 | 
			
		||||
  name: "Lokal",
 | 
			
		||||
  url: Routes.live_url(Endpoint, PageLive)) %>
 | 
			
		||||
  "This email was sent from Lokal at %{url}, the self-hosted firearm tracker website.",
 | 
			
		||||
  url: Routes.live_url(Endpoint, HomeLive)) %>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,20 +3,19 @@
 | 
			
		||||
    <%= dgettext("actions", "Resend confirmation instructions") %>
 | 
			
		||||
  </h1>
 | 
			
		||||
 | 
			
		||||
  <%= form_for :user,
 | 
			
		||||
           Routes.user_confirmation_path(@conn, :create),
 | 
			
		||||
           [
 | 
			
		||||
             class:
 | 
			
		||||
               "flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
           ],
 | 
			
		||||
           fn f -> %>
 | 
			
		||||
  <.form
 | 
			
		||||
    let={f}
 | 
			
		||||
    for={:user}
 | 
			
		||||
    action={Routes.user_confirmation_path(@conn, :create)}
 | 
			
		||||
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
  >
 | 
			
		||||
    <%= label(f, :email, class: "title text-lg text-primary-600") %>
 | 
			
		||||
    <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
 | 
			
		||||
 | 
			
		||||
    <%= submit(dgettext("actions", "Resend confirmation instructions"),
 | 
			
		||||
      class: "mx-auto btn btn-primary col-span-3"
 | 
			
		||||
    ) %>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  </.form>
 | 
			
		||||
 | 
			
		||||
  <hr class="hr" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,12 @@
 | 
			
		||||
    <%= dgettext("actions", "Register") %>
 | 
			
		||||
  </h1>
 | 
			
		||||
 | 
			
		||||
  <%= form_for @changeset,
 | 
			
		||||
           Routes.user_registration_path(@conn, :create),
 | 
			
		||||
           [
 | 
			
		||||
             class:
 | 
			
		||||
               "flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
           ],
 | 
			
		||||
           fn f -> %>
 | 
			
		||||
  <.form
 | 
			
		||||
    let={f}
 | 
			
		||||
    for={@changeset}
 | 
			
		||||
    action={Routes.user_registration_path(@conn, :create)}
 | 
			
		||||
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
  >
 | 
			
		||||
    <%= if @changeset.action && not @changeset.valid? do %>
 | 
			
		||||
      <div class="alert alert-danger col-span-3">
 | 
			
		||||
        <p>
 | 
			
		||||
@@ -40,7 +39,7 @@
 | 
			
		||||
    <%= error_tag(f, :locale) %>
 | 
			
		||||
 | 
			
		||||
    <%= submit(dgettext("actions", "Register"), class: "mx-auto btn btn-primary col-span-3") %>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  </.form>
 | 
			
		||||
 | 
			
		||||
  <hr class="hr" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,12 @@
 | 
			
		||||
    <%= dgettext("actions", "Reset password") %>
 | 
			
		||||
  </h1>
 | 
			
		||||
 | 
			
		||||
  <%= form_for @changeset,
 | 
			
		||||
           Routes.user_reset_password_path(@conn, :update, @token),
 | 
			
		||||
           [
 | 
			
		||||
             class:
 | 
			
		||||
               "flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
           ],
 | 
			
		||||
           fn f -> %>
 | 
			
		||||
  <.form
 | 
			
		||||
    let={f}
 | 
			
		||||
    for={@changeset}
 | 
			
		||||
    action={Routes.user_reset_password_path(@conn, :update, @token)}
 | 
			
		||||
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
  >
 | 
			
		||||
    <%= if @changeset.action && not @changeset.valid? do %>
 | 
			
		||||
      <div class="alert alert-danger col-span-3">
 | 
			
		||||
        <p>
 | 
			
		||||
@@ -34,7 +33,7 @@
 | 
			
		||||
    <%= submit(dgettext("actions", "Reset password"),
 | 
			
		||||
      class: "mx-auto btn btn-primary col-span-3"
 | 
			
		||||
    ) %>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  </.form>
 | 
			
		||||
 | 
			
		||||
  <hr class="hr" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,20 +3,19 @@
 | 
			
		||||
    <%= dgettext("actions", "Forgot your password?") %>
 | 
			
		||||
  </h1>
 | 
			
		||||
 | 
			
		||||
  <%= form_for :user,
 | 
			
		||||
           Routes.user_reset_password_path(@conn, :create),
 | 
			
		||||
           [
 | 
			
		||||
             class:
 | 
			
		||||
               "flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
           ],
 | 
			
		||||
           fn f -> %>
 | 
			
		||||
  <.form
 | 
			
		||||
    let={f}
 | 
			
		||||
    for={:user}
 | 
			
		||||
    action={Routes.user_reset_password_path(@conn, :create)}
 | 
			
		||||
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
  >
 | 
			
		||||
    <%= label(f, :email, class: "title text-lg text-primary-600") %>
 | 
			
		||||
    <%= email_input(f, :email, required: true, class: "input input-primary col-span-2") %>
 | 
			
		||||
 | 
			
		||||
    <%= submit(dgettext("actions", "Send instructions to reset password"),
 | 
			
		||||
      class: "mx-auto btn btn-primary col-span-3"
 | 
			
		||||
    ) %>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  </.form>
 | 
			
		||||
 | 
			
		||||
  <hr class="hr" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,14 +3,13 @@
 | 
			
		||||
    <%= dgettext("actions", "Log in") %>
 | 
			
		||||
  </h1>
 | 
			
		||||
 | 
			
		||||
  <%= form_for @conn,
 | 
			
		||||
           Routes.user_session_path(@conn, :create),
 | 
			
		||||
           [
 | 
			
		||||
             as: :user,
 | 
			
		||||
             class:
 | 
			
		||||
               "flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
           ],
 | 
			
		||||
           fn f -> %>
 | 
			
		||||
  <.form
 | 
			
		||||
    let={f}
 | 
			
		||||
    for={@conn}
 | 
			
		||||
    action={Routes.user_session_path(@conn, :create)}
 | 
			
		||||
    as="user"
 | 
			
		||||
    class="flex flex-col space-y-4 sm:space-y-0 sm:grid sm:grid-cols-3 sm:gap-4 justify-center items-center"
 | 
			
		||||
  >
 | 
			
		||||
    <%= if @error_message do %>
 | 
			
		||||
      <div class="alert alert-danger col-span-3">
 | 
			
		||||
        <p>
 | 
			
		||||
@@ -31,7 +30,7 @@
 | 
			
		||||
    <%= checkbox(f, :remember_me, class: "checkbox col-span-2") %>
 | 
			
		||||
 | 
			
		||||
    <%= submit(dgettext("actions", "Log in"), class: "mx-auto btn btn-primary col-span-3") %>
 | 
			
		||||
  <% end %>
 | 
			
		||||
  </.form>
 | 
			
		||||
 | 
			
		||||
  <hr class="hr" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ defmodule LokalWeb.EmailView do
 | 
			
		||||
  @moduledoc """
 | 
			
		||||
  A view for email-related helper functions
 | 
			
		||||
  """
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
 | 
			
		||||
  use LokalWeb, :view
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
defmodule LokalWeb.ErrorView do
 | 
			
		||||
  use LokalWeb, :view
 | 
			
		||||
  import LokalWeb.Components.Topbar
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
 | 
			
		||||
  def template_not_found(error_path, _assigns) do
 | 
			
		||||
    error_string =
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
defmodule LokalWeb.LayoutView do
 | 
			
		||||
  use LokalWeb, :view
 | 
			
		||||
  import LokalWeb.Components.Topbar
 | 
			
		||||
  alias LokalWeb.{Endpoint, PageLive}
 | 
			
		||||
  alias LokalWeb.{Endpoint, HomeLive}
 | 
			
		||||
 | 
			
		||||
  # Phoenix LiveDashboard is available only in development by default,
 | 
			
		||||
  # so we instruct Elixir to not warn if the dashboard route is missing.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user