Changelog
View SourceAll notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[0.3.3] - 2026-08-23
Fixed
- The file
lib/phx_auth_plus/gen/auth/test.exwas silently excluded from the Hex package byexclude_patterns: ["test"], which matches any path containing the string "test". On macOS (installing from Hex) this causedfunction create_auth_test/9 is undefined (module PhxAuthPlus.Gen.Auth.TestFiles is not available). Renamed the file totest_files.exand changed the exclude pattern from"test"to"test/"to only exclude the test directory
[0.3.2] - 2026-08-23
Fixed
- Renamed internal module
PhxAuthPlus.Gen.Auth.TesttoPhxAuthPlus.Gen.Auth.TestFilesto avoid a name collision withExUnit.Teston macOS, which causedfunction create_auth_test/9 is undefined (module PhxAuthPlus.Gen.Auth.Test is not available)at runtime
[0.3.1] - 2026-08-23
Fixed
- Test fixtures
override_token_authenticated_atandoffset_user_tokenwere settingauthenticated_atdirectly on theuser_tokenstable, but that column does not exist.authenticated_atis a virtual field on theUserschema, derived fromtoken.inserted_atin the token verification queries. On macOS with PostgreSQL this caused a "column not found" error; on Windows with SQLite it was silently ignored. Both fixtures now updateinserted_atinstead
[0.3.0] - 2026-08-19
Added
- Password reset (forgot password) flow for LiveView mode:
UserForgotPasswordLiveandUserResetPasswordLivewith routes/users/forgot-passwordand/users/reset-password/:token - "Forgot your password?" link in the login page
get_user_by_confirmation_token/1in the Accounts context for verifying confirmation tokens independently from magic link tokens
Fixed
- Email confirmation flow:
UserConfirmationLive.mount/3was usingget_user_by_magic_link_token(context"login") to verify confirmation tokens (context"confirm"), causing "invalid or expired" errors. Now tries magic link first, then confirmation token, so both flows work through the same/users/log-in/:tokenroute Sudo mode / settings access:
verify_session_token_queryandverify_magic_link_token_queryinUserTokenwere not setting the virtualauthenticated_atfield, causingsudo_mode?/1to always returnfalseand blocking access to/users/settingswith "You must re-authenticate to access this page." Both queries now select%{user | authenticated_at: token.inserted_at}- Confirmation + login:
UserSessionController.create/2with_action: "confirmed"was callinglogin_user_by_magic_link(context"login") on a confirmation token (context"confirm"). Now callsconfirm_user/1thenlog_in_user/2via a dedicatedconfirm_and_log_in/2function
Changed
- Refactored the monolithic
phx_auth_plus.gen.auth.exgenerator (3333 lines) into 11 focused modules underPhxAuthPlus.Gen.Auth.*(Config, Schema, Context, Plug, LiveViews, Controllers, Layout, Router, Migration, Test, UI), with the main task file as a thin orchestrator (214 lines) UserConfirmationLiveerror message changed from "Magic link is invalid or it has expired" to "Confirmation link is invalid or it has expired"
[0.2.0] - 2026-08-19
Changed
- Aligned LiveViews, session controller, and routes with Phoenix 1.8.9
phx.gen.authtemplates - Added magic link authentication alongside password-based login
- Added
update_passwordroute for password updates from settings - Added
fetch_current_scope_for_userplug to the browser pipeline - Updated
create_auth_testandcreate_accounts_fixturesfor the new auth flow and scope usage - Made
hashed_passwordnullable in the migration (magic link users may not have a password) - Made
signed_in_path/1public inUserAuth - Layout header now includes dynamic auth menu (login/register, email/settings/logout)
- Moved hashing test config from the removed
phx_auth_plus.installtask intophx_auth_plus.gen.auth - Updated README and GUIDE to reflect the new architecture (scope system, magic link, file layout)
- Updated token validity: session 14 days (was 60), magic link 15 minutes (new)
Removed
phx_auth_plus.installtask (was auto-triggered by Igniter onmix deps.get, interrupting dependency download and compilation). The hashing config is now applied byphx_auth_plus.gen.authdirectly.
[0.1.0] - 2026-08-19
Added
- Complete email + password authentication generator based on Phoenix
phx.gen.auth - User schema with registration, email, password, and confirmation changesets
- UserToken schema with session, reset password, confirm, and change email tokens
- UserNotifier for email delivery (confirmation, reset password, change email)
- Accounts context with full auth functions:
- Registration and session management
- Password reset (forgot password flow)
- Account confirmation by email
- Email change with confirmation
- Password change with current password validation
- UserAuth plug with:
log_in_user/log_out_userwith session renewal- "Remember me" with secure signed cookies
fetch_current_scope_for_userfrom session or cookieredirect_if_user_is_authenticatedandrequire_authenticated_userplugs- LiveView
on_mounthooks (mount_current_scope,require_authenticated,redirect_if_user_is_authenticated)
- LiveView auth pages (default): login, registration, settings, confirmation
- Controller-based auth pages (with
--no-live): session, registration, settings, reset password, confirmation - Router configuration with guest and authenticated pipelines
- Database migration for users and tokens tables
- Support for multiple hashing libraries: bcrypt (default Unix), pbkdf2 (default Windows), argon2
- Support for binary UUID keys (
--binary-id) - Support for custom table name (
--table) - Support for custom web module (
--web) - Support for umbrella projects (
--context-app) - Built with Igniter for AST-based code generation
Why
Phoenix 1.8 replaced mix phx.gen.auth with a magic-link-only generator.
This package restores the complete email + password authentication that
many applications still need, including password reset, account confirmation,
and "remember me" functionality, while also supporting magic link login.