sendResetPin method
Step 1: Send reset PIN to email. Advances to ForgotPasswordStep.verifyPin on success.
Implementation
Future<void> sendResetPin(String email) async {
state = state.copyWith(isLoading: true, error: null);
final success = await ref
.read(authControllerProvider.notifier)
.forgotPassword(email);
if (success) {
state = state.copyWith(
isLoading: false,
email: email,
step: ForgotPasswordStep.verifyPin,
);
} else {
final error = ref.read(authControllerProvider).error ?? 'Failed to send reset code.';
state = state.copyWith(isLoading: false, error: error);
}
}