diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0f399dc..fe3df41ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,9 @@ x.x.x Release notes (yyyy-MM-dd) * Support Uuid type. ([#470](https://github.com/realm/realm-dart/pull/470)) * Support application login. ([#469](https://github.com/realm/realm-dart/pull/469)) * Support EmailPassword register user. ([#452](https://github.com/realm/realm-dart/pull/452)) -* Support EmailPassowrd confirm user. ([#478](https://github.com/realm/realm-dart/pull/478)) +* Support EmailPassword confirm user. ([#478](https://github.com/realm/realm-dart/pull/478)) +* Support EmailPassword resend user confirmation email. ([#479](https://github.com/realm/realm-dart/pull/479)) +* Support EmailPassword reset password. ([#480](https://github.com/realm/realm-dart/pull/480)) * Support EmailPassowrd resend user confirmation email. ([#479](https://github.com/realm/realm-dart/pull/479)) ### Fixed diff --git a/lib/src/credentials.dart b/lib/src/credentials.dart index 09f2598dd..95e9b1b79 100644 --- a/lib/src/credentials.dart +++ b/lib/src/credentials.dart @@ -85,4 +85,10 @@ class EmailPasswordAuthProvider { Future resendUserConfirmation(String email) { return realmCore.emailPasswordResendUserConfirmation(application, email); } + + /// Completes the reset password procedure by providing the desired new [password] using the + /// password reset [token] and [tokenId] that were emailed to a user. + Future resetPassword(String password, String token, String tokenId) { + return realmCore.emailPasswordResetPassword(application, password, token, tokenId); + } } diff --git a/lib/src/native/realm_core.dart b/lib/src/native/realm_core.dart index c5b3550d5..3cbadc8bf 100644 --- a/lib/src/native/realm_core.dart +++ b/lib/src/native/realm_core.dart @@ -950,6 +950,22 @@ class _RealmCore { }); return completer.future; } + + Future emailPasswordResetPassword(Application application, String password, String token, String tokenId) { + final completer = Completer(); + using((arena) { + _realmLib.invokeGetBool(() => _realmLib.realm_app_email_password_provider_client_reset_password( + application.handle._pointer, + password.toRealmString(arena).ref, + token.toUtf8Ptr(arena), + tokenId.toUtf8Ptr(arena), + Pointer.fromFunction(void_completion_callback), + completer.toPersistentHandle(), + _deletePersistentHandleFuncPtr, + )); + }); + return completer.future; + } } class LastError {