mix phx_auth_plus.gen.auth (phx_auth_plus v0.1.0)
View SourceGenerates complete email + password authentication for Phoenix applications.
Based on Phoenix 1.7.21's phx.gen.auth, restored for Phoenix 1.8+ where the default generator switched to magic links only.
Usage
mix phx_auth_plus.gen.auth Accounts User users
mix phx_auth_plus.gen.auth Accounts User users --no-live
mix phx_auth_plus.gen.auth Accounts User users --hashing-lib pbkdf2
mix phx_auth_plus.gen.auth Accounts User users --binary-id
mix phx_auth_plus.gen.auth Accounts User users --web AuthOptions
--hashing-lib- bcrypt (default Unix), pbkdf2 (default Windows), argon2--live- Generate LiveView auth (default)--no-live- Generate controller-based auth only--binary-id- Use binary UUID keys--web- Web module to use (default: MyAppWeb)--context-app- Context app for umbrella projects--table- Custom table name (default: plural arg)
Generated features
- Email + password registration and login
- "Remember me" with secure cookies
- Password reset (forgot password flow)
- Account confirmation by email
- Settings page (change password, change email)
- Session tracking and invalidation
- UserNotifier for email delivery
After running:
mix ecto.migrate
mix phx.server