Shuffle/app/lib/features/auth/domain/auth_repository.dart
cschlaefke 7c2f684098
All checks were successful
CI / flutter (pull_request) Successful in 1m13s
CI / web-build (pull_request) Successful in 55s
CI / supabase (pull_request) Successful in 3s
CI / supabase-tests (pull_request) Successful in 30s
fix(auth): address review findings for password reset
Finish the recovery guard only after the password change, mark the change
in the repository so a late userUpdated event is harmless, keep the form
locked after success, carry from through the reset check-email page,
share the password error texts and focus the continue button.

Refs #1

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 09:58:31 +01:00

40 lines
1.6 KiB
Dart

import 'package:shuffle/core/result/result.dart';
import 'package:shuffle/features/auth/domain/auth_failure.dart';
import 'package:shuffle/features/auth/domain/auth_status.dart';
import 'package:shuffle/features/auth/domain/email_link_type.dart';
import 'package:shuffle/features/auth/domain/registration_input.dart';
/// Zugriff auf die Anmeldung (Implementierung: Supabase/GoTrue).
abstract interface class AuthRepository {
/// Aktueller Status gefolgt von allen Änderungen.
Stream<AuthStatus> watchStatus();
/// Aktueller Status, synchron (für Router-Redirects).
AuthStatus get currentStatus;
/// Registriert ein Konto. Jede 200-Antwort ist Erfolg; ob die Adresse schon
/// existiert, wird nicht ausgewertet (KTO-01 Kriterium 4).
Future<Result<void, AuthFailure>> signUp(RegistrationInput input);
Future<Result<void, AuthFailure>> resendConfirmation(String email);
Future<Result<void, AuthFailure>> signIn(String email, String password);
Future<Result<void, AuthFailure>> requestPasswordReset(String email);
Future<Result<void, AuthFailure>> verifyEmailLink(
String tokenHash,
EmailLinkType type,
);
Future<Result<void, AuthFailure>> setNewPassword(String password);
/// Beendet den Recovery-Guard, nachdem das neue Passwort gesetzt ist (die
/// Sitzung bleibt bestehen). Ohne laufende Recovery oder vor dem
/// Passwortwechsel ohne Wirkung: Der Guard lässt sich nicht überspringen.
void finishPasswordRecovery();
/// Meldet lokal ab (u. a. beim Abbruch der Recovery). Fehler werden nur
/// geloggt.
Future<void> signOut();
}