fix bug with public registration

This commit is contained in:
shibao 2023-02-04 09:57:10 -05:00
parent f990fafc6a
commit 1726a1b72e
8 changed files with 26 additions and 22 deletions

View File

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

View File

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

View File

@ -42,6 +42,8 @@ config :memex, Memex.Repo,
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
socket_options: maybe_ipv6
config :memex, Memex.Accounts, registration: System.get_env("REGISTRATION", "invite")
config :memex, MemexWeb.Endpoint,
url: [scheme: "https", host: host, port: 443],
http: [
@ -50,8 +52,7 @@ config :memex, MemexWeb.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 Memex.Accounts do
"""
@spec allow_registration?() :: boolean()
def allow_registration? do
Application.get_env(:Memex, MemexWeb.Endpoint)[:registration] == "public" or
Application.get_env(:memex, Memex.Accounts)[:registration] == "public" or
list_users_by_role(:admin) |> Enum.empty?()
end

View File

@ -109,8 +109,7 @@
<li class="flex flex-row justify-center space-x-2">
<b><%= gettext("registration:") %></b>
<p>
<%= Application.get_env(:memex, Endpoint)[:registration]
|> case do
<%= case Application.get_env(:memex, Memex.Accounts)[:registration] do
"public" -> gettext("public signups")
_ -> gettext("invite only")
end %>

View File

@ -4,7 +4,7 @@ defmodule Memex.MixProject do
def project do
[
app: :memex,
version: "0.1.7",
version: "0.1.8",
elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),

View File

@ -163,12 +163,12 @@ msgstr ""
msgid "features"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:138
#: lib/memex_web/live/home_live.html.heex:137
#, elixir-autogen, elixir-format
msgid "get involved!"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:159
#: lib/memex_web/live/home_live.html.heex:158
#, elixir-autogen, elixir-format
msgid "help translate"
msgstr ""
@ -183,7 +183,7 @@ msgstr ""
msgid "invite disabled"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:115
#: lib/memex_web/live/home_live.html.heex:114
#, elixir-autogen, elixir-format
msgid "invite only"
msgstr ""
@ -266,7 +266,7 @@ msgstr ""
msgid "provide context around a single topic and hotlink to your notes"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:114
#: lib/memex_web/live/home_live.html.heex:113
#, elixir-autogen, elixir-format
msgid "public signups"
msgstr ""
@ -281,7 +281,7 @@ msgstr ""
msgid "registration:"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:170
#: lib/memex_web/live/home_live.html.heex:169
#, elixir-autogen, elixir-format
msgid "report bugs or request features"
msgstr ""
@ -330,12 +330,12 @@ msgstr ""
msgid "users"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:121
#: lib/memex_web/live/home_live.html.heex:120
#, elixir-autogen, elixir-format
msgid "version:"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:148
#: lib/memex_web/live/home_live.html.heex:147
#, elixir-autogen, elixir-format
msgid "view the source code"
msgstr ""

View File

@ -152,12 +152,12 @@ msgstr ""
msgid "features"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:138
#: lib/memex_web/live/home_live.html.heex:137
#, elixir-autogen, elixir-format
msgid "get involved!"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:159
#: lib/memex_web/live/home_live.html.heex:158
#, elixir-autogen, elixir-format
msgid "help translate"
msgstr ""
@ -172,7 +172,7 @@ msgstr ""
msgid "invite disabled"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:115
#: lib/memex_web/live/home_live.html.heex:114
#, elixir-autogen, elixir-format
msgid "invite only"
msgstr ""
@ -255,7 +255,7 @@ msgstr ""
msgid "provide context around a single topic and hotlink to your notes"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:114
#: lib/memex_web/live/home_live.html.heex:113
#, elixir-autogen, elixir-format
msgid "public signups"
msgstr ""
@ -270,7 +270,7 @@ msgstr ""
msgid "registration:"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:170
#: lib/memex_web/live/home_live.html.heex:169
#, elixir-autogen, elixir-format
msgid "report bugs or request features"
msgstr ""
@ -319,12 +319,12 @@ msgstr ""
msgid "users"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:121
#: lib/memex_web/live/home_live.html.heex:120
#, elixir-autogen, elixir-format
msgid "version:"
msgstr ""
#: lib/memex_web/live/home_live.html.heex:148
#: lib/memex_web/live/home_live.html.heex:147
#, elixir-autogen, elixir-format
msgid "view the source code"
msgstr ""