fix user registration controller

This commit is contained in:
shibao 2023-06-04 00:11:09 -04:00
parent d2ae6024ce
commit 3e296080f5
11 changed files with 25 additions and 23 deletions

View File

@ -1,4 +1,5 @@
# v0.1.12 # v0.1.12
- Code quality fixes
- Fix error/404 pages not rendering properly - Fix error/404 pages not rendering properly
# v0.1.11 # v0.1.11

View File

@ -1,6 +1,7 @@
defmodule MemexWeb.UserRegistrationController do defmodule MemexWeb.UserRegistrationController do
use MemexWeb, :controller use MemexWeb, :controller
import MemexWeb.Gettext import MemexWeb.Gettext
alias Ecto.Changeset
alias Memex.{Accounts, Accounts.Invites} alias Memex.{Accounts, Accounts.Invites}
def new(conn, %{"invite" => invite_token}) do def new(conn, %{"invite" => invite_token}) do
@ -69,8 +70,8 @@ defmodule MemexWeb.UserRegistrationController do
|> put_flash(:error, dgettext("errors", "sorry, this invite was not found or expired")) |> put_flash(:error, dgettext("errors", "sorry, this invite was not found or expired"))
|> redirect(to: ~p"/") |> redirect(to: ~p"/")
{:error, %Ecto.Changeset{} = changeset} -> {:error, %Changeset{} = changeset} ->
conn |> render("new.html", changeset: changeset, invite_token: invite_token) conn |> render(:new, changeset: changeset, invite_token: invite_token)
end end
end end
end end

View File

@ -228,7 +228,7 @@ msgstr ""
msgid "public signups" msgid "public signups"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:31 #: lib/memex_web/controllers/user_registration_controller.ex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "register" msgid "register"
msgstr "" msgstr ""

View File

@ -93,9 +93,9 @@ msgstr ""
msgid "oops, something went wrong! please check the errors below." msgid "oops, something went wrong! please check the errors below."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:11 #: lib/memex_web/controllers/user_registration_controller.ex:12
#: lib/memex_web/controllers/user_registration_controller.ex:40 #: lib/memex_web/controllers/user_registration_controller.ex:41
#: lib/memex_web/controllers/user_registration_controller.ex:69 #: lib/memex_web/controllers/user_registration_controller.ex:70
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "sorry, this invite was not found or expired" msgid "sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -136,8 +136,8 @@ msgstr ""
msgid "reset password link is invalid or it has expired." msgid "reset password link is invalid or it has expired."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:21 #: lib/memex_web/controllers/user_registration_controller.ex:22
#: lib/memex_web/controllers/user_registration_controller.ex:50 #: lib/memex_web/controllers/user_registration_controller.ex:51
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""

View File

@ -106,7 +106,7 @@ msgstr ""
msgid "copied to clipboard" msgid "copied to clipboard"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:64 #: lib/memex_web/controllers/user_registration_controller.ex:65
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "please check your email to verify your account" msgid "please check your email to verify your account"
msgstr "" msgstr ""

View File

@ -226,7 +226,7 @@ msgstr ""
msgid "public signups" msgid "public signups"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:31 #: lib/memex_web/controllers/user_registration_controller.ex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "register" msgid "register"
msgstr "" msgstr ""

View File

@ -227,7 +227,7 @@ msgstr ""
msgid "public signups" msgid "public signups"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:31 #: lib/memex_web/controllers/user_registration_controller.ex:32
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "register" msgid "register"
msgstr "" msgstr ""

View File

@ -94,9 +94,9 @@ msgstr ""
msgid "oops, something went wrong! please check the errors below." msgid "oops, something went wrong! please check the errors below."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:11 #: lib/memex_web/controllers/user_registration_controller.ex:12
#: lib/memex_web/controllers/user_registration_controller.ex:40 #: lib/memex_web/controllers/user_registration_controller.ex:41
#: lib/memex_web/controllers/user_registration_controller.ex:69 #: lib/memex_web/controllers/user_registration_controller.ex:70
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "sorry, this invite was not found or expired" msgid "sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -137,8 +137,8 @@ msgstr ""
msgid "reset password link is invalid or it has expired." msgid "reset password link is invalid or it has expired."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:21 #: lib/memex_web/controllers/user_registration_controller.ex:22
#: lib/memex_web/controllers/user_registration_controller.ex:50 #: lib/memex_web/controllers/user_registration_controller.ex:51
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""

View File

@ -107,7 +107,7 @@ msgstr ""
msgid "copied to clipboard" msgid "copied to clipboard"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:64 #: lib/memex_web/controllers/user_registration_controller.ex:65
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "please check your email to verify your account" msgid "please check your email to verify your account"
msgstr "" msgstr ""

View File

@ -93,9 +93,9 @@ msgstr ""
msgid "oops, something went wrong! please check the errors below." msgid "oops, something went wrong! please check the errors below."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:11 #: lib/memex_web/controllers/user_registration_controller.ex:12
#: lib/memex_web/controllers/user_registration_controller.ex:40 #: lib/memex_web/controllers/user_registration_controller.ex:41
#: lib/memex_web/controllers/user_registration_controller.ex:69 #: lib/memex_web/controllers/user_registration_controller.ex:70
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "sorry, this invite was not found or expired" msgid "sorry, this invite was not found or expired"
msgstr "" msgstr ""
@ -136,8 +136,8 @@ msgstr ""
msgid "reset password link is invalid or it has expired." msgid "reset password link is invalid or it has expired."
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:21 #: lib/memex_web/controllers/user_registration_controller.ex:22
#: lib/memex_web/controllers/user_registration_controller.ex:50 #: lib/memex_web/controllers/user_registration_controller.ex:51
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "sorry, public registration is disabled" msgid "sorry, public registration is disabled"
msgstr "" msgstr ""

View File

@ -106,7 +106,7 @@ msgstr ""
msgid "copied to clipboard" msgid "copied to clipboard"
msgstr "" msgstr ""
#: lib/memex_web/controllers/user_registration_controller.ex:64 #: lib/memex_web/controllers/user_registration_controller.ex:65
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "please check your email to verify your account" msgid "please check your email to verify your account"
msgstr "" msgstr ""