implemented optional 'allow_registration' config, with first registered user being pre-confirmed Admin, registration unavailable after that point if allow_registration: :false
This commit is contained in:
parent
ea74a89078
commit
f27df8d676
22 changed files with 395 additions and 244 deletions
lib/shift73k_web/views
|
|
@ -1,9 +1,12 @@
|
|||
defmodule Shift73kWeb.LayoutView do
|
||||
use Shift73kWeb, :view
|
||||
|
||||
alias Shift73k.Repo
|
||||
alias Shift73k.Accounts.User
|
||||
alias Shift73kWeb.Roles
|
||||
|
||||
@app_vars Application.compile_env(:shift73k, :app_global_vars, allow_registration: :true)
|
||||
@app_allow_registration @app_vars[:allow_registration]
|
||||
|
||||
# With a Vite.js-based workflow, we will import different asset files in development
|
||||
# and in production builds. Therefore, we will need a way to conditionally render
|
||||
# <script> tags based on Mix environment. However, since Mix is not available in
|
||||
|
|
@ -11,6 +14,8 @@ defmodule Shift73kWeb.LayoutView do
|
|||
@env Mix.env() # remember value at compile time
|
||||
def dev_env?, do: @env == :dev
|
||||
|
||||
def allow_registration, do: @app_allow_registration
|
||||
|
||||
def nav_link_opts(conn, opts) do
|
||||
case Keyword.get(opts, :to) == Phoenix.Controller.current_path(conn) do
|
||||
false -> opts
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
defmodule Shift73kWeb.UserConfirmationView do
|
||||
use Shift73kWeb, :view
|
||||
alias Shift73k.Accounts.User
|
||||
|
||||
@app_vars Application.compile_env(:shift73k, :app_global_vars, allow_registration: :true)
|
||||
@app_allow_registration @app_vars[:allow_registration]
|
||||
|
||||
def allow_registration, do: @app_allow_registration
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
defmodule Shift73kWeb.UserResetPasswordView do
|
||||
use Shift73kWeb, :view
|
||||
alias Shift73k.Accounts.User
|
||||
|
||||
@app_vars Application.compile_env(:shift73k, :app_global_vars, allow_registration: :true)
|
||||
@app_allow_registration @app_vars[:allow_registration]
|
||||
|
||||
def allow_registration, do: @app_allow_registration
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
defmodule Shift73kWeb.UserSessionView do
|
||||
use Shift73kWeb, :view
|
||||
alias Shift73k.Accounts.User
|
||||
|
||||
@app_vars Application.compile_env(:shift73k, :app_global_vars, allow_registration: :true)
|
||||
@app_allow_registration @app_vars[:allow_registration]
|
||||
|
||||
def allow_registration, do: @app_allow_registration
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue