verifyPin method
Step 2: Verify the pin sent to the user's email.
On success, stores resetToken and advances to ForgotPasswordStep.newPassword.
Implementation
Future<void> verifyPin(String pin) async {
state = state.copyWith(isLoading: true, error: null);
try {
state = state.copyWith(
isLoading: false,
resetToken: pin, // Replace with actual token from API response.
step: ForgotPasswordStep.newPassword,
);
} catch (_) {
state = state.copyWith(isLoading: false, error: 'Invalid or expired code.');
}
}