Skip to content

feat(auth): add email/password authentication flow with router redirect and localized errors - #5

Merged
CowboyGH merged 20 commits into
developfrom
feature/email-password-auth
Jan 9, 2026
Merged

CowboyGH merged 20 commits into
developfrom
feature/email-password-auth

Conversation

@CowboyGH

@CowboyGH CowboyGH commented Jan 8, 2026 •

Copy link
Copy Markdown
Owner

🚀 Summary

Adds an email/password authentication baseline on top of Firebase Auth, including domain user modeling, typed failures + mappers, repository + BLoC, auth-aware GoRouter redirects, localized error messages, and supporting maintenance/CI updates.

✨ Changes

  • ✅ Added User domain entity + UserMapper (Firebase User → domain User).
  • ✅ Added AuthRepository contract and AuthRepositoryImpl (Firebase Authentication).
  • ✅ Added typed authentication failures (AuthFailure hierarchy, incl. UnknownAuthFailure) + AuthFailureMapper (FirebaseAuthException → AuthFailure).
  • ✅ Added unit tests for AuthRepositoryImpl (success, Firebase exceptions, unexpected errors, auth state stream), incl. extra sign-out and authStateChanges verifications.
  • ✅ Added AuthBloc for auth events/state handling + unit tests for AuthBloc.
  • ✅ Implemented email/password auth UI (SignInPage) with sign in / sign up flow.
  • ✅ Added DebugScreen sign out action for quick manual verification.
  • ✅ Added auth-aware routing with GoRouter redirect (/auth/* is public, other routes require authentication) and updated auth paths to /auth/* prefix.
  • 🌍 Added localized authentication failure messages (ARB + AuthFailure → l10n mapper).
  • 🧹 Maintenance: changed AppFailure constructor signature (message is now positional), removed AsyncResult<T>, improved auth failure docs/comments, removed unnecessary .gitkeep, and updated Firebase deps.
  • 🧹 Updated .gitignore to exclude generated *.freezed.dart files (Build Runner output).

🛠 CI

  • 🧰 Fixed CI failing due to missing generated Freezed files by running build_runner code generation in CI/Dockerfile.

🧪 Verification

  • flutter analyze
  • flutter test
  • CI checks pass (Docker build with code generation)
  • Manual test: sign up → sign out → sign in (happy path + error cases).

@CowboyGH
CowboyGH force-pushed the feature/email-password-auth branch from 2cb6d22 to cacc367 Compare January 9, 2026 06:15
@CowboyGH
CowboyGH merged commit 245b658 into develop Jan 9, 2026
3 checks passed
@CowboyGH
CowboyGH deleted the feature/email-password-auth branch February 3, 2026 03:52
CowboyGH added a commit that referenced this pull request Feb 3, 2026
* feat(auth): add email/password authentication flow with router redirect and localized errors (#5)

* refactor(core): simplify AppFailure ctor and remove AsyncResult alias

* feat(auth): add User entity and AuthRepository interface for authentication operations

* feat(auth): add typed AuthFailure and Firebase mappers

* feat(auth): implement AuthRepository using Firebase Authentication

* test(auth): cover AuthRepositoryImpl

* test(auth): enhance AuthRepositoryImpl tests with signOut and authStateChanges verifications

* chore: add *.freezed.dart to .gitignore for Build Runner generated files

* feat(auth): implement AuthBloc with authentication events and states

* test(auth): cover AuthBloc

* feat(auth): implement SignInPage and update routing for authentication

* feat(debug): add Sign Out button to DebugScreen for testing AuthBloc

* feat(auth): implement redirect logic and auth state listener in router

* feat(auth): add localized error messages for authentication failures

* docs(core): add descriptive comments for authentication failure classes

* refactor(auth): simplify comments and documentation in authentication files and di

* chore: remove empty .gitkeep files from unnecessary directories

* chore: update Firebase dependencies to latest versions

* fix(ci): add code generation step to CI/CD pipeline and Dockerfile

* docs(core): update documentation for authentication failure classes

* docs: update CHANGELOG.md

* feat(auth): added Google Sign-In authentication (#6)

* chore(ios): add Google Sign-In Info.plist config

* feat(deps): add google_sign_in package to pubspec.yaml

* feat(auth): add signInWithGoogle method to AuthRepository

* feat(core): implement new AuthFailure classes for google auth integration, enhance l10n mapper and make it nullable

* feat(auth): implement mapper for converting exceptions from google auth to AuthFailure

* feat(auth): implement signInWithGoogle method in AuthRepositoryImpl

* test(auth): cover signInWithGoogle method with tests

* feat(core): register dependencies for google auth in DI and make setupDI method async

* fix(auth): fix snack bar error handling on sign-in page

* feat(auth): add google sign-in handler method to AuthBloc

* test(auth): cover sign-in handler method with tests

* feat(auth): add button for sign-in with google

* docs: update CHANGELOG.md

* feat: add devtools_options.yaml

* refactor(auth): improve code readability by formatting method signatures

* feat(auth): prevent multiple authentication requests during ongoing operations

* feat(auth): log analytics events for sign-in, sign-up, sign-out, and Google sign-in actions

* chore: add comment for Google sign-in handling

* refactor(auth): replace BlocConsumer with BlocListener and remove loading state tracking for improved state handling

* refactor(auth): replace TextEditingController with form field onSaved for email and password

* feat(auth): enhance validator rules for email and password fields

* feat(auth): update sign-in/sign-up toggle text for clarity and improved UX

* refactor(auth): streamline functions syntax and reduce code length

* refactor(router): rename variable for clarity in redirect logic

* refactor(auth): simplify documentation for authentication methods

* feat(auth): add sign-in/sign-up headline text

* docs: update CHANGELOG.md

* chore: update version to 0.3.0 in pubspec.yaml

* fix(auth): add analytics verify() assertions to Bloc tests (CI fix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant