feat(01-06): create password update page with validation
- Implemented UpdatePasswordPage with password strength indicator - Added password validation utility with comprehensive checks - Enhanced AuthProvider with updatePasswordFromReset method - Extended AuthRepository interface and implementation for password reset - Added InvalidTokenException to auth exception hierarchy - Includes accessibility features and error handling - Password strength indicator with real-time feedback Files: - lib/features/authentication/presentation/pages/update_password_page.dart - lib/core/utils/password_validator.dart - lib/providers/auth_provider.dart - lib/features/authentication/domain/repositories/auth_repository.dart - lib/features/authentication/data/repositories/auth_repository_impl.dart - lib/core/errors/auth_exceptions.dart
This commit is contained in:
@@ -393,6 +393,28 @@ class AuthProvider extends StateNotifier<AuthState> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates password from reset token (password reset flow)
|
||||
///
|
||||
/// [newPassword] - The new password to set
|
||||
///
|
||||
/// Throws AuthException if update fails
|
||||
Future<void> updatePasswordFromReset(String newPassword) async {
|
||||
if (state.isLoading) return;
|
||||
|
||||
state = state.copyWith(isLoading: true, clearError: true);
|
||||
|
||||
try {
|
||||
await _authRepository.updatePasswordFromReset(newPassword);
|
||||
state = state.copyWith(isLoading: false);
|
||||
} catch (e) {
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
error: e.toString(),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Clears any authentication error
|
||||
void clearError() {
|
||||
state = state.copyWith(clearError: true);
|
||||
|
||||
Reference in New Issue
Block a user