remove unnecessary auth check on invite page

This commit is contained in:
shibao 2023-03-19 00:23:59 -04:00
parent 440dc5061b
commit daab051026
19 changed files with 56 additions and 96 deletions

View File

@ -6,21 +6,11 @@ defmodule CanneryWeb.InviteLive.Index do
use CanneryWeb, :live_view
alias Cannery.Accounts
alias Cannery.Accounts.{Invite, Invites}
alias CanneryWeb.HomeLive
alias Phoenix.LiveView.JS
@impl true
def mount(_params, _session, %{assigns: %{current_user: current_user}} = socket) do
socket =
if current_user |> Map.get(:role) == :admin do
socket |> display_invites()
else
prompt = dgettext("errors", "You are not authorized to view this page")
return_to = Routes.live_path(Endpoint, HomeLive)
socket |> put_flash(:error, prompt) |> push_redirect(to: return_to)
end
{:ok, socket}
def mount(_params, _session, socket) do
{:ok, socket |> display_invites()}
end
@impl true

View File

@ -141,7 +141,7 @@ msgstr "Beschreibung:"
msgid "Easy to Use:"
msgstr "Einfache Anwendung:"
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr "Einladung bearbeiten"
@ -189,7 +189,7 @@ msgid "Invite Only"
msgstr "Nur mit Einladung"
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -256,7 +256,7 @@ msgstr "Neuer Munitionstyp"
msgid "New Container"
msgstr "Neuer Behälter"
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr "Neue Einladung"

View File

@ -112,11 +112,6 @@ msgstr "Unbefugt"
msgid "User confirmation link is invalid or it has expired."
msgstr "Nutzerkonto Bestätigungslink ist ungültig oder abgelaufen."
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr "Sie sind nicht berechtigt, diese Seite aufzurufen"
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -203,7 +203,7 @@ msgstr "%{email} erfolgreich bestätigt."
msgid "Ammo moved to %{name} successfully"
msgstr "Munition erfolgreich zu %{name} verschoben"
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr "Der Zwischenablage hinzugefügt"
@ -268,27 +268,27 @@ msgstr "Sind Sie sicher, dass sie %{name} löschen möchten?"
msgid "Register to setup Cannery"
msgstr "Registrieren Sie sich, um %{name} zu bearbeiten"
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} deleted succesfully"
msgstr "%{name} erfolgreich gelöscht"
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} disabled succesfully"
msgstr "%{name} erfolgreich deaktiviert"
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} enabled succesfully"
msgstr "%{name} erfolgreich aktiviert"
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} updated succesfully"
msgstr "%{name} erfolgreich aktualisiert"
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully"
msgstr "%{name} erfolgreich gelöscht"

View File

@ -137,7 +137,7 @@ msgstr ""
msgid "Easy to Use:"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr ""
@ -185,7 +185,7 @@ msgid "Invite Only"
msgstr ""
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -252,7 +252,7 @@ msgstr ""
msgid "New Container"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr ""

View File

@ -137,7 +137,7 @@ msgstr ""
msgid "Easy to Use:"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr ""
@ -185,7 +185,7 @@ msgid "Invite Only"
msgstr ""
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -252,7 +252,7 @@ msgstr ""
msgid "New Container"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr ""

View File

@ -98,11 +98,6 @@ msgstr ""
msgid "User confirmation link is invalid or it has expired."
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr ""
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -182,7 +182,7 @@ msgstr ""
msgid "Ammo moved to %{name} successfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr ""
@ -247,27 +247,27 @@ msgstr ""
msgid "Register to setup Cannery"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} disabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully"
msgstr ""

View File

@ -98,11 +98,6 @@ msgstr ""
msgid "User confirmation link is invalid or it has expired."
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr ""
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -141,7 +141,7 @@ msgstr "Descripción:"
msgid "Easy to Use:"
msgstr "Facil de Usar:"
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr "Editar Invitación"
@ -189,7 +189,7 @@ msgid "Invite Only"
msgstr "Solo Invitación"
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -256,7 +256,7 @@ msgstr "Nuevo tipo de Munición"
msgid "New Container"
msgstr "Nuevo Contenedor"
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr "Nueva Invitación"

View File

@ -114,11 +114,6 @@ msgstr "No autorizado"
msgid "User confirmation link is invalid or it has expired."
msgstr "El enlace de confirmación de usuario no es válido o ha caducado."
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr "No está autorizado a ver esta página"
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -202,7 +202,7 @@ msgstr "%{email} confirmado exitosamente."
msgid "Ammo moved to %{name} successfully"
msgstr "Munición movida a %{name} exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr "Copiado al portapapeles"
@ -269,27 +269,27 @@ msgstr ""
msgid "Register to setup Cannery"
msgstr "Regístrese para configurar %{name}"
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} deleted succesfully"
msgstr "%{name} borrado exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} disabled succesfully"
msgstr "%{name} desactivado exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} enabled succesfully"
msgstr "%{name} activado exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} updated succesfully"
msgstr "%{name} actualizado exitosamente"
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully"
msgstr "%{name} borrado exitosamente"

View File

@ -141,7 +141,7 @@ msgstr "Description:"
msgid "Easy to Use:"
msgstr "Simple à utiliser:"
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr "Modifier linvitation"
@ -189,7 +189,7 @@ msgid "Invite Only"
msgstr "Uniquement sur invitation"
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -256,7 +256,7 @@ msgstr "Nouveau type de munition"
msgid "New Container"
msgstr "Nouveau conteneur"
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr "Nouvelle invitation"

View File

@ -113,11 +113,6 @@ msgstr "Non autorisé·e"
msgid "User confirmation link is invalid or it has expired."
msgstr "Le lien de confirmation dutilisateur·ice est invalide ou a expiré."
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr "Vous nêtes pas autorisé·e à voir cette page"
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -204,7 +204,7 @@ msgstr "%{email} confirmé avec succès."
msgid "Ammo moved to %{name} successfully"
msgstr "Munition déplacée à %{name} avec succès"
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr "Copié dans le presse-papier"
@ -269,27 +269,27 @@ msgstr "Êtes-vous certain·e de supprimer %{name}?"
msgid "Register to setup Cannery"
msgstr "Senregistrer pour mettre en place %{name}"
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} deleted succesfully"
msgstr "%{name} supprimé· avec succès"
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} disabled succesfully"
msgstr "%{name} supprimé·e avec succès"
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} enabled succesfully"
msgstr "%{name} activé·e avec succès"
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} updated succesfully"
msgstr "%{name} mis à jour avec succès"
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully"
msgstr "%{name} supprimé· avec succès"

View File

@ -139,7 +139,7 @@ msgstr ""
msgid "Easy to Use:"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:33
#: lib/cannery_web/live/invite_live/index.ex:23
#, elixir-autogen, elixir-format
msgid "Edit Invite"
msgstr ""
@ -187,7 +187,7 @@ msgid "Invite Only"
msgstr ""
#: lib/cannery_web/components/core_components/topbar.html.heex:74
#: lib/cannery_web/live/invite_live/index.ex:41
#: lib/cannery_web/live/invite_live/index.ex:31
#: lib/cannery_web/live/invite_live/index.html.heex:3
#, elixir-autogen, elixir-format
msgid "Invites"
@ -254,7 +254,7 @@ msgstr ""
msgid "New Container"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:37
#: lib/cannery_web/live/invite_live/index.ex:27
#, elixir-autogen, elixir-format
msgid "New Invite"
msgstr ""

View File

@ -114,11 +114,6 @@ msgstr "Níl cead agaibh"
msgid "User confirmation link is invalid or it has expired."
msgstr "Tá nasc an úsáideoir a deimhnigh neamhbailí nó as dáta."
#: lib/cannery_web/live/invite_live/index.ex:18
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page"
msgstr "Níl cead agaibh féachaint ar an leathanach seo"
#: lib/cannery_web/controllers/user_auth.ex:177
#, elixir-autogen, elixir-format
msgid "You are not authorized to view this page."

View File

@ -193,7 +193,7 @@ msgstr ""
msgid "Ammo moved to %{name} successfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr ""
@ -261,27 +261,27 @@ msgstr ""
msgid "Register to setup Cannery"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} disabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format, fuzzy
msgid "%{invite_name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format, fuzzy
msgid "%{user_email} deleted succesfully"
msgstr ""

View File

@ -182,7 +182,7 @@ msgstr ""
msgid "Ammo moved to %{name} successfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:126
#: lib/cannery_web/live/invite_live/index.ex:116
#, elixir-autogen, elixir-format
msgid "Copied to clipboard"
msgstr ""
@ -247,27 +247,27 @@ msgstr ""
msgid "Register to setup Cannery"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:53
#: lib/cannery_web/live/invite_live/index.ex:43
#, elixir-autogen, elixir-format
msgid "%{invite_name} deleted succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:114
#: lib/cannery_web/live/invite_live/index.ex:104
#, elixir-autogen, elixir-format
msgid "%{invite_name} disabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:90
#: lib/cannery_web/live/invite_live/index.ex:80
#, elixir-autogen, elixir-format
msgid "%{invite_name} enabled succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:68
#: lib/cannery_web/live/invite_live/index.ex:58
#, elixir-autogen, elixir-format
msgid "%{invite_name} updated succesfully"
msgstr ""
#: lib/cannery_web/live/invite_live/index.ex:135
#: lib/cannery_web/live/invite_live/index.ex:125
#, elixir-autogen, elixir-format
msgid "%{user_email} deleted succesfully"
msgstr ""