Add configurable prevention of user registration
Should be done appropriately soon.
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user