resetPassword static method

Future<Map<String, dynamic>> resetPassword({
  1. required String userId,
  2. required String secret,
  3. required String password,
  4. required String passwordAgain,
})

Returns a map with the following keys: if there was no error:

  • token: Token from Appwrite if there was an error:
  • error: true if there was an error
  • type: error if there was an error
  • message: String containing the error message
  • code: int containing the error code

Implementation

static Future<Map<String, dynamic>> resetPassword({
  /// User ID
  required String userId,

  /// Secret token
  required String secret,

  /// Password for the email
  required String password,

  /// Password confirmation for the email
  required String passwordAgain,
}) async {
  try {
    final models.Token token = await _account.updateRecovery(
      userId: _token!.userId,
      secret: _token!.secret,
      password: password,
      passwordAgain: passwordAgain,
    );

    return token.toMap();
  } on AppwriteException catch (e) {
    return {
      'error': true,
      'type': e.type,
      'message': e.message,
      'code': e.code,
    };
  }
}