add button to resend email verification email

This commit is contained in:
shibao 2025-01-31 23:55:53 -05:00
parent 3eda522903
commit 08916a504f
14 changed files with 101 additions and 35 deletions
CHANGELOG.md
config
lib/cannery_web
priv/gettext
de/LC_MESSAGES
en/LC_MESSAGES
es/LC_MESSAGES
fr/LC_MESSAGES
ga/LC_MESSAGES
it/LC_MESSAGES
prompts.pot

@ -1,4 +1,5 @@
# v0.9.13 # v0.9.13
- Add button to resend email verification email
- Move staging to container, rather than ammo - Move staging to container, rather than ammo
- Add date restriction dropdown to range page - Add date restriction dropdown to range page
- Fix dates not rendering properly in table - Fix dates not rendering properly in table

@ -8,6 +8,7 @@
import Config import Config
config :cannery, config :cannery,
env: :dev,
ecto_repos: [Cannery.Repo], ecto_repos: [Cannery.Repo],
generators: [binary_id: true] generators: [binary_id: true]

@ -14,6 +14,8 @@ config :cannery, CanneryWeb.Endpoint, cache_static_manifest: "priv/static/cache_
# Do not print debug messages in production # Do not print debug messages in production
config :logger, level: :info config :logger, level: :info
config :cannery, env: :prod
# ## SSL Support # ## SSL Support
# #
# To get SSL working, you will need to add the `https` key # To get SSL working, you will need to add the `https` key

@ -20,6 +20,8 @@ config :cannery, CanneryWeb.Endpoint,
secret_key_base: "S3qq9QtUdsFtlYej+HTjAVN95uP5i5tf2sPYINWSQfCKJghFj2B1+wTAoljZyHOK", secret_key_base: "S3qq9QtUdsFtlYej+HTjAVN95uP5i5tf2sPYINWSQfCKJghFj2B1+wTAoljZyHOK",
server: false server: false
config :cannery, env: :test
# In test we don't send emails. # In test we don't send emails.
config :cannery, Cannery.Mailer, adapter: Swoosh.Adapters.Test config :cannery, Cannery.Mailer, adapter: Swoosh.Adapters.Test

@ -116,6 +116,20 @@ defmodule CanneryWeb.InviteLive.Index do
{:noreply, socket |> put_flash(:info, dgettext("prompts", "Copied to clipboard"))} {:noreply, socket |> put_flash(:info, dgettext("prompts", "Copied to clipboard"))}
end end
def handle_event("resend_email_verification", %{"id" => id}, socket) do
%{email: user_email} = user = Accounts.get_user!(id)
Accounts.deliver_user_confirmation_instructions(
user,
fn token -> url(CanneryWeb.Endpoint, ~p"/users/confirm/#{token}") end
)
prompt =
dgettext("prompts", "Email resent to %{user_email} succesfully", user_email: user_email)
{:noreply, socket |> put_flash(:info, prompt) |> display_invites()}
end
def handle_event( def handle_event(
"delete_user", "delete_user",
%{"id" => id}, %{"id" => id},

@ -1,10 +1,10 @@
<div class="mx-auto flex flex-col justify-center items-center space-y-4 max-w-3xl"> <div class="flex flex-col justify-center items-center mx-auto space-y-4 max-w-3xl">
<h1 class="title text-2xl title-primary-500"> <h1 class="text-2xl title title-primary-500">
<%= gettext("Invites") %> <%= gettext("Invites") %>
</h1> </h1>
<%= if @invites |> Enum.empty?() do %> <%= if @invites |> Enum.empty?() do %>
<h1 class="title text-xl text-primary-600"> <h1 class="text-xl title text-primary-600">
<%= gettext("No invites") %> <%= gettext("No invites") %>
<%= display_emoji("😔") %> <%= display_emoji("😔") %>
</h1> </h1>
@ -95,7 +95,7 @@
<%= unless @admins |> Enum.empty?() do %> <%= unless @admins |> Enum.empty?() do %>
<hr class="hr" /> <hr class="hr" />
<h1 class="title text-2xl text-primary-600"> <h1 class="text-2xl title text-primary-600">
<%= gettext("Admins") %> <%= gettext("Admins") %>
</h1> </h1>
@ -123,27 +123,38 @@
<%= unless @users |> Enum.empty?() do %> <%= unless @users |> Enum.empty?() do %>
<hr class="hr" /> <hr class="hr" />
<h1 class="title text-2xl text-primary-600"> <h1 class="text-2xl title text-primary-600">
<%= gettext("Users") %> <%= gettext("Users") %>
</h1> </h1>
<div class="flex flex-col justify-center items-stretch space-y-4"> <div class="flex flex-col justify-center items-stretch space-y-4">
<.user_card :for={user <- @users} user={user}> <.user_card :for={user <- @users} user={user}>
<.link <div class="flex justify-center items-center space-x-2">
href="#" <.link
class="text-primary-600 link" :if={!user.confirmed_at}
phx-click="delete_user" class="text-primary-600 link"
phx-value-id={user.id} href="#"
data-confirm={ phx-click="resend_email_verification"
dgettext( phx-value-id={user.id}
"prompts", >
"Are you sure you want to delete %{email}? This action is permanent!", <i class="fa-fw fa-lg fas fa-paper-plane"></i>
email: user.email </.link>
) <.link
} class="text-primary-600 link"
> data-confirm={
<i class="fa-fw fa-lg fas fa-trash"></i> dgettext(
</.link> "prompts",
"Are you sure you want to delete %{email}? This action is permanent!",
email: user.email
)
}
href="#"
phx-click="delete_user"
phx-value-id={user.id}
>
<i class="fa-fw fa-lg fas fa-trash"></i>
</.link>
</div>
</.user_card> </.user_card>
</div> </div>
<% end %> <% end %>

@ -120,7 +120,7 @@ defmodule CanneryWeb.Router do
# #
# Note that preview only shows emails that were sent by the same # Note that preview only shows emails that were sent by the same
# node running the Phoenix server. # node running the Phoenix server.
if Mix.env() == :dev do if Application.compile_env(:cannery, :env) == :dev do
scope "/dev" do scope "/dev" do
pipe_through :browser pipe_through :browser

@ -58,7 +58,7 @@ msgid "A link to confirm your email change has been sent to the new address."
msgstr "Eine Mail zum Bestätigen ihre Mailadresse wurde Ihnen zugesandt." msgstr "Eine Mail zum Bestätigen ihre Mailadresse wurde Ihnen zugesandt."
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -278,7 +278,7 @@ msgstr "%{name} erfolgreich aktiviert"
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "%{name} erfolgreich aktualisiert" msgstr "%{name} erfolgreich aktualisiert"
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "%{name} erfolgreich gelöscht" msgstr "%{name} erfolgreich gelöscht"
@ -297,3 +297,8 @@ msgstr "Sind Sie sicher, dass sie %{name} auf unbegrenzt setzen möchten?"
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -45,7 +45,7 @@ msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -257,7 +257,7 @@ msgstr ""
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "" msgstr ""
@ -276,3 +276,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -60,7 +60,7 @@ msgstr ""
"dirección." "dirección."
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!" msgstr "Está seguro que desea eliminar %{email}? Esta acción es permanente!"
@ -279,7 +279,7 @@ msgstr "%{name} activado exitosamente"
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "%{name} actualizado exitosamente" msgstr "%{name} actualizado exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "%{name} borrado exitosamente" msgstr "%{name} borrado exitosamente"
@ -298,3 +298,8 @@ msgstr "Está seguro que desea hacer %{name} ilimitado?"
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -60,7 +60,7 @@ msgstr ""
"adresse." "adresse."
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -279,7 +279,7 @@ msgstr "%{name} activé·e avec succès"
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "%{name} mis à jour avec succès" msgstr "%{name} mis à jour avec succès"
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "%{name} supprimé· avec succès" msgstr "%{name} supprimé· avec succès"
@ -298,3 +298,8 @@ msgstr "Êtes-vous certain·e de vouloir rendre %{name} illimité?"
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -56,7 +56,7 @@ msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -271,7 +271,7 @@ msgstr ""
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "" msgstr ""
@ -290,3 +290,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -56,7 +56,7 @@ msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -268,7 +268,7 @@ msgstr ""
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "" msgstr ""
@ -287,3 +287,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

@ -45,7 +45,7 @@ msgid "A link to confirm your email change has been sent to the new address."
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.html.heex:110 #: lib/cannery_web/live/invite_live/index.html.heex:110
#: lib/cannery_web/live/invite_live/index.html.heex:138 #: lib/cannery_web/live/invite_live/index.html.heex:145
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Are you sure you want to delete %{email}? This action is permanent!" msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr "" msgstr ""
@ -257,7 +257,7 @@ msgstr ""
msgid "%{invite_name} updated succesfully" msgid "%{invite_name} updated succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:125 #: lib/cannery_web/live/invite_live/index.ex:139
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "%{user_email} deleted succesfully" msgid "%{user_email} deleted succesfully"
msgstr "" msgstr ""
@ -276,3 +276,8 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Container unstaged succesfully" msgid "Container unstaged succesfully"
msgstr "" msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""