Skip to content

Phase 2: Authentication 🔐

This phase documents the user entry point, including login, registration, and password recovery, alongside the core Firebase Auth service.


🖼️ UI Reference

Login Screen{: .mobile-frame } Signup Screen{: .mobile-frame }


🔐 Login Screen (login_screen.dart)

This screen provides a modern, curved UI for user authentication.

Key Features:

  • Email/Password Auth: Core authentication method.
  • Google Sign-In: Integrated via google_sign_in package.
  • Validation: Real-time email format and password strength validation.
  • Persistence: "Remember Me" functionality to stay logged in.

📝 Signup Screen (signup_screen.dart)

Handles new user registration and data initialization.

Logic Flow:

  1. User enters Name, Email, Phone, and Password.
  2. App validates that passwords match and T&Cs are accepted.
  3. FirebaseAuthService.register() is called to create the account.
  4. A new user document is created in Firestore with 0 initial points.

🔑 Forgot Password

Multi-step recovery process using OTP (One-Time Password). 1. Request: User enters email. 2. Verify: User enters 6-digit PIN. 3. Reset: User sets a new password.


⚙️ Auth Service (firebase_auth_service.dart)

The core service managing user state. It uses the firebase_auth package and interacts with the users collection in Firestore.

Key Methods:

  • signInWithEmail(): Authenticates via Firebase.
  • signOut(): Clears local session and provider state.
  • updateProfile(): Synchronizes user metadata with Firestore.