AshAuthenticationPhoenix controlling generated routes

I setup my phoenix app using the getting started with ash authentication guide. If I understand correctly adding routes works as follows:
# Added for macros and functions
use AshAuthentication.Phoenix.Router
pipeline :browser do
# ...
# Plug to load session from cookie
plug :load_from_session
end
scope "/", ExampleWeb do
pipe_through :browser

get "/", PageController, :home

# Adds a liveview at /sign-in based on Example.Accounts.User
sign_in_route()
# Adds a sign out get route for signing out uses logic defined in AuthController
sign_out_route AuthController
# Adds a sign in and register route that the /sign-in liveview uses to login and/or register a user, also uses logic defined in AuthController plus data from Example.Accounts.User resource?
auth_routes_for Example.Accounts.User, to: AuthController
# Unused reset route
reset_route []
end
# Added for macros and functions
use AshAuthentication.Phoenix.Router
pipeline :browser do
# ...
# Plug to load session from cookie
plug :load_from_session
end
scope "/", ExampleWeb do
pipe_through :browser

get "/", PageController, :home

# Adds a liveview at /sign-in based on Example.Accounts.User
sign_in_route()
# Adds a sign out get route for signing out uses logic defined in AuthController
sign_out_route AuthController
# Adds a sign in and register route that the /sign-in liveview uses to login and/or register a user, also uses logic defined in AuthController plus data from Example.Accounts.User resource?
auth_routes_for Example.Accounts.User, to: AuthController
# Unused reset route
reset_route []
end
Would it be possible to remove the register route from auth_routes_for generation? I would like more control over how new users can register. Can the register page also be removed from the /sign-in liveview? I want to setup registration separately
Ash HQ
Guide: Getting Started With Ash Authentication Phoenix
Read the "Getting Started With Ash Authentication Phoenix" guide on Ash HQ
7 Replies
kernel
kernel2y ago
you can customise the pages
kernel
kernel2y ago
Alembic
Customising Ash Authentication with Phoenix LiveView
A Sydney-based Software Development Consultancy building cutting edge Web and API experiences with Elixir, TypeScript, GraphQL and React.
kernel
kernel2y ago
more or less following this
jart
jart2y ago
Do you want to disable registration altogether? You can set registration_enabled? false inside the password strategy
morfertaw
morfertawOP2y ago
I want to have admins that are either a role on users or a separate resource. Admins will have access to specific routes when logged in that allow them to register new users and/or admins.
jart
jart2y ago
Yeah just disable registration and add your own create action.
morfertaw
morfertawOP2y ago
Yeah, that seems like the way to go. Thanks!

Did you find this page helpful?