sendPasswordResetEmail method

  1. @override
Future<bool> sendPasswordResetEmail({
  1. required String email,
})
override

Implementation

@override
Future<bool> sendPasswordResetEmail({required String email}) async {
  final MonitoringService monitoringService = core.get<MonitoringService>();
  var trace =
      await monitoringService.createTrace(name: 'sendPasswordResetEmail');
  trace.start();
  try {
    if (!isReady) {
      throw LittlefishFirebaseAuthException('AUTH_INIT_000',
          '$providerName: Firebase is not initialized, $providerName cannot send password reset email');
    }

    logger.debug(
      this,
      "$providerName: Sending password reset email to $email",
    );

    await kInstance?.sendPasswordResetEmail(email: email);

    logger.info(
      this,
      "$providerName: Password reset email sent to $email",
    );

    return true;
  } on FirebaseAuthException catch (e) {
    throw _handleFirebaseAuthException(e);
  } catch (e) {
    if (e is LittlefishException) {
      rethrow;
    }
    throw LittlefishFirebaseAuthException(
      'AUTH_014',
      'An unexpected error occurred while sending password reset email.',
      cause: e,
    );
  } finally {
    trace.stop();
  }
}