@react-native-ohos/realm
Version:
Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores
106 lines • 4.62 kB
JavaScript
;
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2022 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////
Object.defineProperty(exports, "__esModule", { value: true });
exports.EmailPasswordAuth = void 0;
/**
* Authentication provider where users identify using email and password.
* @see https://www.mongodb.com/docs/atlas/app-services/authentication/email-password/
*/
class EmailPasswordAuth {
/** @internal */
internal;
/** @internal */
constructor(internal) {
this.internal = internal;
}
/**
* Registers a new email identity with the email/password provider,
* and sends a confirmation email to the provided address.
* @param details - The new user's email and password details.
* @param details.email - The email address of the user to register.
* @param details.password - The password that the user created for the new username/password identity.
* @since v10.10.0
*/
async registerUser(details) {
await this.internal.registerEmail(details.email, details.password);
}
/**
* Confirms an email identity with the email/password provider.
* @param details - The received token and ID details
* @param details.token - The confirmation token that was emailed to the user.
* @param details.tokenId - The confirmation token id that was emailed to the user.
* @since v10.10.0
*/
async confirmUser(details) {
await this.internal.confirmUser(details.token, details.tokenId);
}
/**
* Re-sends a confirmation email to a user that has registered but
* not yet confirmed their email address.
* @param details - The associated email details.
* @param details.email - The email address of the user to re-send a confirmation for.
* @since v10.10.0
*/
async resendConfirmationEmail(details) {
await this.internal.resendConfirmationEmail(details.email);
}
/**
* Re-run the custom confirmation function for user that has registered but
* not yet confirmed their email address.
* @param details - The associated email details.
* @param details.email - The email address of the user to re-run the confirmation for.
* @since v10.10.0
*/
async retryCustomConfirmation(details) {
await this.internal.retryCustomConfirmation(details.email);
}
/**
* Resets the password of an email identity using the password reset token emailed to a user.
* @param details - The token and password details for the reset.
* @param details.password - The desired new password.
* @param details.token - The password reset token that was emailed to the user.
* @param details.tokenId - The password reset token id that was emailed to the user.
* @since v10.10.0
*/
async resetPassword(details) {
await this.internal.resetPassword(details.password, details.token, details.tokenId);
}
/**
* Sends an email to the user for resetting the password.
* @param details - The email details to send the reset to.
* @param details.email - The email address of the user to re-send a confirmation for.
* @since v10.10.0
*/
async sendResetPasswordEmail(details) {
await this.internal.sendResetPasswordEmail(details.email);
}
/**
* Call the custom function to reset the password.
* @param details - The new user's email and password details.
* @param details.email - The email address of the user to register.
* @param details.password - The password that the user created for the new username/password identity.
* @param args One or more arguments to pass to the function.
* @since v10.10.0
*/
async callResetPasswordFunction(details, ...args) {
await this.internal.callResetPasswordFunction(details.email, details.password, args);
}
}
exports.EmailPasswordAuth = EmailPasswordAuth;
//# sourceMappingURL=EmailPasswordAuth.js.map