Add configurable prevention of user registration

Should be done appropriately soon.
This commit is contained in:
Thelonius Kort
2023-01-31 18:16:28 +01:00
parent 54b609185d
commit c5853fc2aa
4 changed files with 29 additions and 4 deletions

View File

@ -3,6 +3,8 @@ defmodule OutlookWeb.Router do
import OutlookWeb.UserAuth
import Outlook.PreventRegistration
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
@ -18,6 +20,10 @@ defmodule OutlookWeb.Router do
plug :put_layout, {OutlookWeb.Layouts, :public}
end
pipeline :check_registration do
plug :prevent_registration
end
pipeline :api do
plug :accepts, ["json"]
end
@ -56,7 +62,7 @@ defmodule OutlookWeb.Router do
## Authentication routes
scope "/", OutlookWeb do
pipe_through [:browser, :redirect_if_user_is_authenticated]
pipe_through [:browser, :redirect_if_user_is_authenticated, :check_registration]
live_session :redirect_if_user_is_authenticated,
on_mount: [{OutlookWeb.UserAuth, :redirect_if_user_is_authenticated}] do