Search.../

promptForgotPassword( )

Prompts the current site visitor with a password reset modal.

Description

The promptForgotPassword() function returns a Promise that resolves when the visitor submits the Create New Password form.

If the visitor cancels the form without submitting it, the Promise is rejected.

promptForgotPassword() cannot be called before the page is ready.

Notes:

  • The APIs in wix-members-frontend are only partially functional when previewing your site. View a published version of your site to see their complete functionality.

  • The APIs in wix-members-frontend can only be used once the page has loaded. Therefore, you must use them in code that is contained in or is called from the onReady() event handler or any element event handler.

  • If you return or await the promptForgotPassword() function when calling from onReady(), the page will be prevented from loading. To handle the resolved promise, use .then() and .catch().

Syntax

function promptForgotPassword(): Promise<void>

promptForgotPassword Parameters

This function does not take any parameters.

Returns

Fulfilled - When the form is submitted. Rejected - Message that the dialog was canceled, user is already logged in, or another reason the password reset failed.

Return Type:

Promise<void>

Related Content:

Was this helpful?

Prompt the visitor with a password reset

Copy Code
1import { authentication } from 'wix-members-frontend';
2
3// ...
4
5authentication.promptForgotPassword()
6 .then(() => {
7 console.log('Sending "forgot password" email');
8 })
9 .catch((error) => {
10 console.error(error);
11 });