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:
Dani B
2026-01-28 12:05:15 -05:00
parent a9f1bf75e8
commit e56dd26fef
6 changed files with 616 additions and 1 deletions

View File

@@ -120,6 +120,19 @@ class EmailNotVerifiedException extends AuthException {
);
}
/// Exception thrown when a reset token is invalid or expired
class InvalidTokenException extends AuthException {
const InvalidTokenException({
String message = 'Reset token is invalid or has expired',
String? code,
dynamic originalError,
}) : super(
message: message,
code: code ?? 'INVALID_TOKEN',
originalError: originalError,
);
}
/// Exception thrown when too many login attempts are made
class TooManyRequestsException extends AuthException {
const TooManyRequestsException({
@@ -198,6 +211,17 @@ class AuthExceptionFactory {
);
}
if (lowerMessage.contains('invalid token') ||
lowerMessage.contains('token expired') ||
lowerMessage.contains('reset token') ||
lowerMessage.contains('session has expired')) {
return InvalidTokenException(
message: _extractUserFriendlyMessage(errorMessage) ?? 'Reset token is invalid or has expired',
code: errorCode,
originalError: error,
);
}
if (lowerMessage.contains('user not found') ||
lowerMessage.contains('no user found') ||
lowerMessage.contains('user does not exist')) {