diff --git a/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt b/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt new file mode 100644 index 00000000..658f456e --- /dev/null +++ b/app/src/main/java/app/closer/domain/repository/PasswordResetException.kt @@ -0,0 +1,18 @@ +package app.closer.domain.repository + +/** + * Typed reasons a "forgot password" request can't complete, mapped from Firebase specifics at the auth + * data-source boundary. Using these instead of matching on Firebase's human-readable error strings keeps + * detection robust across SDK/locale changes; the UI layer owns the user-facing copy per type. + * + * Note: under Firebase email-enumeration protection (enabled on this project), a reset for an unknown or + * Google-only address returns success — so [NoAccount] is only surfaced if that protection is disabled. + * The Google-only case is handled by enumeration-safe copy in the UI rather than a provider lookup. + */ +sealed class PasswordResetException(message: String) : Exception(message) { + /** No account exists for the given email (only reachable when email-enumeration protection is off). */ + class NoAccount : PasswordResetException("No account for email") + + /** The email address is malformed (a pure format check; always applies). */ + class InvalidEmail : PasswordResetException("Malformed email") +}