fix bug with public registration

This commit is contained in:
shibao 2023-02-04 09:56:34 -05:00
parent 2f8af8ae4f
commit 084173909e
12 changed files with 48 additions and 44 deletions

View File

@ -1,3 +1,6 @@
# v0.8.2
- Fix bug with public registration
# v0.8.1
- Update dependencies
- Show topbar on form submit/page refresh

View File

@ -11,6 +11,8 @@ config :cannery,
ecto_repos: [Cannery.Repo],
generators: [binary_id: true]
config :cannery, Cannery.Accounts, registration: System.get_env("REGISTRATION", "invite")
# Configures the endpoint
config :cannery, CanneryWeb.Endpoint,
url: [scheme: "https", host: System.get_env("HOST") || "localhost", port: "443"],
@ -18,8 +20,7 @@ config :cannery, CanneryWeb.Endpoint,
secret_key_base: "KH59P0iZixX5gP/u+zkxxG8vAAj6vgt0YqnwEB5JP5K+E567SsqkCz69uWShjE7I",
render_errors: [view: CanneryWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Cannery.PubSub,
live_view: [signing_salt: "zOLgd3lr"],
registration: System.get_env("REGISTRATION") || "invite"
live_view: [signing_salt: "zOLgd3lr"]
config :cannery, Cannery.Application, automigrate: false

View File

@ -44,6 +44,8 @@ config :cannery, Cannery.Repo,
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
socket_options: maybe_ipv6
config :cannery, Cannery.Accounts, registration: System.get_env("REGISTRATION", "invite")
config :cannery, CanneryWeb.Endpoint,
url: [scheme: "https", host: host, port: 443],
http: [
@ -52,8 +54,7 @@ config :cannery, CanneryWeb.Endpoint,
ip: interface,
port: String.to_integer(System.get_env("PORT", "4000"))
],
server: true,
registration: System.get_env("REGISTRATION", "invite")
server: true
if config_env() == :prod do
# The secret key base is used to sign/encrypt cookies and other secrets.

View File

@ -384,7 +384,7 @@ defmodule Cannery.Accounts do
"""
@spec allow_registration?() :: boolean()
def allow_registration? do
Application.get_env(:Cannery, CanneryWeb.Endpoint)[:registration] == "public" or
Application.get_env(:cannery, Cannery.Accounts)[:registration] == "public" or
list_users_by_role(:admin) |> Enum.empty?()
end

View File

@ -105,8 +105,7 @@ defmodule CanneryWeb.HomeLive do
<li class="flex flex-row justify-center space-x-2">
<b>Registration:</b>
<p>
<%= Application.get_env(:cannery, CanneryWeb.Endpoint)[:registration]
|> case do
<%= case Application.get_env(:cannery, Cannery.Accounts)[:registration] do
"public" -> gettext("Public Signups")
_ -> gettext("Invite Only")
end %>

View File

@ -4,7 +4,7 @@ defmodule Cannery.MixProject do
def project do
[
app: :cannery,
version: "0.8.1",
version: "0.8.2",
elixir: "1.14.1",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),

View File

@ -199,7 +199,7 @@ msgstr "Instanzinformationen"
msgid "Invite Disabled"
msgstr "Einladung deaktiviert"
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr "Nur mit Einladung"
@ -355,7 +355,7 @@ msgstr "Kaufpreis:"
msgid "Primer type"
msgstr "Zündertyp"
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr "Öffentliche Registrierung"
@ -752,22 +752,22 @@ msgstr "Deutsch"
msgid "Language"
msgstr "Sprache"
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr "Mach mit!"
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr "Hilf beim Übersetzen"
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr "Sende Bugs oder Erweiterungsvorschläge"
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr "Quellcode ansehen"

View File

@ -184,7 +184,7 @@ msgstr ""
msgid "Invite Disabled"
msgstr ""
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr ""
@ -340,7 +340,7 @@ msgstr ""
msgid "Primer type"
msgstr ""
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr ""
@ -735,22 +735,22 @@ msgstr ""
msgid "Language"
msgstr ""
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr ""
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr ""
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr ""
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr ""

View File

@ -184,7 +184,7 @@ msgstr ""
msgid "Invite Disabled"
msgstr ""
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr ""
@ -340,7 +340,7 @@ msgstr ""
msgid "Primer type"
msgstr ""
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr ""
@ -735,22 +735,22 @@ msgstr ""
msgid "Language"
msgstr ""
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr ""
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr ""
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr ""
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr ""

View File

@ -199,7 +199,7 @@ msgstr "Información de Instancia"
msgid "Invite Disabled"
msgstr "Invitación Desactivada"
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr "Solo Invitación"
@ -355,7 +355,7 @@ msgstr "Precio pagado:"
msgid "Primer type"
msgstr "Tipo de espoleta"
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr "Registro Público"
@ -753,22 +753,22 @@ msgstr "Alemán"
msgid "Language"
msgstr "Idioma"
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr "¡Implícate!"
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr "Ayuda a traducir"
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr "Informar de errores o solicitar funciones"
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr "Ver código fuente"

View File

@ -199,7 +199,7 @@ msgstr "Information de linstance"
msgid "Invite Disabled"
msgstr "Invitation désactivée"
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr "Uniquement sur invitation"
@ -355,7 +355,7 @@ msgstr "Prix payé:"
msgid "Primer type"
msgstr "Type damorce"
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr "Enregistrements publics"
@ -754,22 +754,22 @@ msgstr "Allemand"
msgid "Language"
msgstr "Langue"
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr "Impliquez-vous!"
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr "Aider à la traduction"
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr "Remonter des bugs ou une demande de fonctionnalité"
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr "Voir le code source"

View File

@ -195,7 +195,7 @@ msgstr ""
msgid "Invite Disabled"
msgstr ""
#: lib/cannery_web/live/home_live.ex:111
#: lib/cannery_web/live/home_live.ex:110
#, elixir-autogen, elixir-format
msgid "Invite Only"
msgstr ""
@ -351,7 +351,7 @@ msgstr ""
msgid "Primer type"
msgstr ""
#: lib/cannery_web/live/home_live.ex:110
#: lib/cannery_web/live/home_live.ex:109
#, elixir-autogen, elixir-format
msgid "Public Signups"
msgstr ""
@ -746,22 +746,22 @@ msgstr ""
msgid "Language"
msgstr ""
#: lib/cannery_web/live/home_live.ex:136
#: lib/cannery_web/live/home_live.ex:135
#, elixir-autogen, elixir-format
msgid "Get involved!"
msgstr ""
#: lib/cannery_web/live/home_live.ex:157
#: lib/cannery_web/live/home_live.ex:156
#, elixir-autogen, elixir-format
msgid "Help translate"
msgstr ""
#: lib/cannery_web/live/home_live.ex:168
#: lib/cannery_web/live/home_live.ex:167
#, elixir-autogen, elixir-format
msgid "Report bugs or request features"
msgstr ""
#: lib/cannery_web/live/home_live.ex:146
#: lib/cannery_web/live/home_live.ex:145
#, elixir-autogen, elixir-format
msgid "View the source code"
msgstr ""