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

View File

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

View File

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

View File

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

View File

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

View File

@ -116,6 +116,20 @@ defmodule CanneryWeb.InviteLive.Index do
{:noreply, socket |> put_flash(:info, dgettext("prompts", "Copied to clipboard"))}
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(
"delete_user",
%{"id" => id},

View File

@ -1,10 +1,10 @@
<div class="mx-auto flex flex-col justify-center items-center space-y-4 max-w-3xl">
<h1 class="title text-2xl title-primary-500">
<div class="flex flex-col justify-center items-center mx-auto space-y-4 max-w-3xl">
<h1 class="text-2xl title title-primary-500">
<%= gettext("Invites") %>
</h1>
<%= if @invites |> Enum.empty?() do %>
<h1 class="title text-xl text-primary-600">
<h1 class="text-xl title text-primary-600">
<%= gettext("No invites") %>
<%= display_emoji("😔") %>
</h1>
@ -95,7 +95,7 @@
<%= unless @admins |> Enum.empty?() do %>
<hr class="hr" />
<h1 class="title text-2xl text-primary-600">
<h1 class="text-2xl title text-primary-600">
<%= gettext("Admins") %>
</h1>
@ -123,17 +123,24 @@
<%= unless @users |> Enum.empty?() do %>
<hr class="hr" />
<h1 class="title text-2xl text-primary-600">
<h1 class="text-2xl title text-primary-600">
<%= gettext("Users") %>
</h1>
<div class="flex flex-col justify-center items-stretch space-y-4">
<.user_card :for={user <- @users} user={user}>
<div class="flex justify-center items-center space-x-2">
<.link
href="#"
:if={!user.confirmed_at}
class="text-primary-600 link"
phx-click="delete_user"
href="#"
phx-click="resend_email_verification"
phx-value-id={user.id}
>
<i class="fa-fw fa-lg fas fa-paper-plane"></i>
</.link>
<.link
class="text-primary-600 link"
data-confirm={
dgettext(
"prompts",
@ -141,9 +148,13 @@
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>
</div>
<% end %>

View File

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

View File

@ -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."
#: 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
msgid "Are you sure you want to delete %{email}? This action is permanent!"
msgstr ""
@ -278,7 +278,7 @@ msgstr "%{name} erfolgreich aktiviert"
msgid "%{invite_name} updated succesfully"
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
msgid "%{user_email} deleted succesfully"
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
msgid "Container unstaged succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

View File

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

View File

@ -60,7 +60,7 @@ msgstr ""
"dirección."
#: 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
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!"
@ -279,7 +279,7 @@ msgstr "%{name} activado exitosamente"
msgid "%{invite_name} updated succesfully"
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
msgid "%{user_email} deleted succesfully"
msgstr "%{name} borrado exitosamente"
@ -298,3 +298,8 @@ msgstr "Está seguro que desea hacer %{name} ilimitado?"
#, elixir-autogen, elixir-format
msgid "Container unstaged succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:128
#, elixir-autogen, elixir-format
msgid "Email resent to %{user_email} succesfully"
msgstr ""

View File

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

View File

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

View File

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

View File

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