Week 3: Authentication & Profile - Codeman239/TruckMate GitHub Wiki

Week 3: Authentication & Profile

Features Implemented

  • Email/password sign‑in & sign‑up screens (Firebase Auth)
  • User profiles saved to Firestore under users/{uid}

Code Snippets

// LoginScreen.kt (ui/auth/LoginScreen.kt)
@Composable
fun LoginScreen(onSuccess: (FirebaseUser) -> Unit) { … }

// saveUserProfile() persists displayName & photoUrl
private fun saveUserProfile(user: FirebaseUser, db: FirebaseFirestore) { … }
Firestore Security Rules Excerpt

service cloud.firestore {
  match /databases/{db}/documents {
    match /users/{userId} {
      allow read, write: if request.auth.uid == userId;
    }
  }
}

Testing
Created and tested with two accounts: [email protected], [email protected]

Verified login, logout, error messaging for invalid credentials

Release
Merged feature/auth → main

Tagged v0.1-auth

Next Steps:
Week 4: Map & Location Integration