remove unnecessary auth check on invite page
This commit is contained in:
parent
bf91eadd8e
commit
d495db0bb3
@ -6,21 +6,11 @@ defmodule MemexWeb.InviteLive.Index do
|
||||
use MemexWeb, :live_view
|
||||
alias Memex.Accounts
|
||||
alias Memex.Accounts.{Invite, Invites}
|
||||
alias MemexWeb.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
|
||||
|
@ -99,7 +99,7 @@ msgstr ""
|
||||
msgid "document your processes, attaching contexts to each step"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:33
|
||||
#: lib/memex_web/live/invite_live/index.ex:23
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "edit invite"
|
||||
msgstr ""
|
||||
@ -154,7 +154,7 @@ msgid "invite only"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/components/core_components/topbar.html.heex:58
|
||||
#: lib/memex_web/live/invite_live/index.ex:41
|
||||
#: lib/memex_web/live/invite_live/index.ex:31
|
||||
#: lib/memex_web/live/invite_live/index.html.heex:3
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "invites"
|
||||
@ -170,7 +170,7 @@ msgstr ""
|
||||
msgid "multi-user:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:37
|
||||
#: lib/memex_web/live/invite_live/index.ex:27
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "new invite"
|
||||
msgstr ""
|
||||
|
@ -122,11 +122,6 @@ msgstr ""
|
||||
msgid "sorry, this invite was not found or expired"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:18
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "you are not authorized to view this page"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "email change link is invalid or it has expired."
|
||||
|
@ -15,27 +15,27 @@ msgstr ""
|
||||
msgid "%{email} confirmed successfully."
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:53
|
||||
#: lib/memex_web/live/invite_live/index.ex:43
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} deleted succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:114
|
||||
#: lib/memex_web/live/invite_live/index.ex:104
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} disabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:90
|
||||
#: lib/memex_web/live/invite_live/index.ex:80
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} enabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:68
|
||||
#: lib/memex_web/live/invite_live/index.ex:58
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} updated succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:136
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{user_email} deleted succesfully"
|
||||
msgstr ""
|
||||
@ -116,7 +116,7 @@ msgstr ""
|
||||
msgid "%{name} updated successfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#: lib/memex_web/live/invite_live/index.ex:116
|
||||
#, elixir-autogen, elixir-format, fuzzy
|
||||
msgid "copied to clipboard"
|
||||
msgstr ""
|
||||
|
@ -97,7 +97,7 @@ msgstr ""
|
||||
msgid "document your processes, attaching contexts to each step"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:33
|
||||
#: lib/memex_web/live/invite_live/index.ex:23
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "edit invite"
|
||||
msgstr ""
|
||||
@ -152,7 +152,7 @@ msgid "invite only"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/components/core_components/topbar.html.heex:58
|
||||
#: lib/memex_web/live/invite_live/index.ex:41
|
||||
#: lib/memex_web/live/invite_live/index.ex:31
|
||||
#: lib/memex_web/live/invite_live/index.html.heex:3
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "invites"
|
||||
@ -168,7 +168,7 @@ msgstr ""
|
||||
msgid "multi-user:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:37
|
||||
#: lib/memex_web/live/invite_live/index.ex:27
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "new invite"
|
||||
msgstr ""
|
||||
|
@ -98,7 +98,7 @@ msgstr ""
|
||||
msgid "document your processes, attaching contexts to each step"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:33
|
||||
#: lib/memex_web/live/invite_live/index.ex:23
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "edit invite"
|
||||
msgstr ""
|
||||
@ -153,7 +153,7 @@ msgid "invite only"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/components/core_components/topbar.html.heex:58
|
||||
#: lib/memex_web/live/invite_live/index.ex:41
|
||||
#: lib/memex_web/live/invite_live/index.ex:31
|
||||
#: lib/memex_web/live/invite_live/index.html.heex:3
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "invites"
|
||||
@ -169,7 +169,7 @@ msgstr ""
|
||||
msgid "multi-user:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:37
|
||||
#: lib/memex_web/live/invite_live/index.ex:27
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "new invite"
|
||||
msgstr ""
|
||||
|
@ -123,11 +123,6 @@ msgstr ""
|
||||
msgid "sorry, this invite was not found or expired"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:18
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "you are not authorized to view this page"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "email change link is invalid or it has expired."
|
||||
|
@ -16,27 +16,27 @@ msgstr ""
|
||||
msgid "%{email} confirmed successfully."
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:53
|
||||
#: lib/memex_web/live/invite_live/index.ex:43
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} deleted succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:114
|
||||
#: lib/memex_web/live/invite_live/index.ex:104
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} disabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:90
|
||||
#: lib/memex_web/live/invite_live/index.ex:80
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} enabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:68
|
||||
#: lib/memex_web/live/invite_live/index.ex:58
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} updated succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:136
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{user_email} deleted succesfully"
|
||||
msgstr ""
|
||||
@ -117,7 +117,7 @@ msgstr ""
|
||||
msgid "%{name} updated successfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#: lib/memex_web/live/invite_live/index.ex:116
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "copied to clipboard"
|
||||
msgstr ""
|
||||
|
@ -122,11 +122,6 @@ msgstr ""
|
||||
msgid "sorry, this invite was not found or expired"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:18
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "you are not authorized to view this page"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/controllers/user_settings_controller.ex:84
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "email change link is invalid or it has expired."
|
||||
|
@ -15,27 +15,27 @@ msgstr ""
|
||||
msgid "%{email} confirmed successfully."
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:53
|
||||
#: lib/memex_web/live/invite_live/index.ex:43
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} deleted succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:114
|
||||
#: lib/memex_web/live/invite_live/index.ex:104
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} disabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:90
|
||||
#: lib/memex_web/live/invite_live/index.ex:80
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} enabled succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:68
|
||||
#: lib/memex_web/live/invite_live/index.ex:58
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{invite_name} updated succesfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:136
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "%{user_email} deleted succesfully"
|
||||
msgstr ""
|
||||
@ -116,7 +116,7 @@ msgstr ""
|
||||
msgid "%{name} updated successfully"
|
||||
msgstr ""
|
||||
|
||||
#: lib/memex_web/live/invite_live/index.ex:126
|
||||
#: lib/memex_web/live/invite_live/index.ex:116
|
||||
#, elixir-autogen, elixir-format
|
||||
msgid "copied to clipboard"
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user