wixUsers.promptForgotPassword(); not working

Hello, I am working on a website that has a custom registration login area as lightbox. The forget password function is not working.
[code|

import wixUsers from ‘wix-users’;
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
import { session } from ‘wix-storage’;

var userId, userEmail;

$w.onReady( function () {
//TODO: write your page related code here…
});

export function button2_click(event, $w) {
login();
}

export function password_keyPress(event, $w) {
if (event.key === “Enter”) login();
}

export async function login() {
$w(“#textFail”).hide();
let email = $w(“#email”).value;
let password = $w(“#password”).value;

wixUsers.login(email, password) 
    .then(() => { 
        console.log("User is logged in"); 
        wixWindow.lightbox.close( **true** ); 

let siteEventPageUrl = session.getItem(“siteEventPageUrl”);
console.log(siteEventPageUrl);
if (siteEventPageUrl) wixLocation.to(siteEventPageUrl);
else wixLocation.to(“/events-wix”);
})
. catch ((err) => {
console.log(err);
$w(“#textFail”).show();
});
}

export function textForgotPassword_click(event) {
//wixWindow.lightbox.close();
wixUsers.promptForgotPassword();
}

export function button14_click(event) {
//wixWindow.lightbox.close();
wixUsers.promptForgotPassword();
}

export function close_click(event) {
wixWindow.lightbox.close( false );
}

[/code]
The site url is https://winebrennerdesigns.wixsite.com/kindcraft

Does anyone know why the code is not working? Thank you in advance!
Melissa

Hello Melissa,

It seems that you are calling that promise without resolving it so it does not finish. To fix this just simply chain a . then() to it so that it can be resolved, like so:

wixUsers.promptForgotPassword()
    .then(() => {
        //Runs if successful
        console.log("Password reset submitted");
    }).catch((err) => {
        //Runs if there is error and displays the error
        console.log('error: ', err);
    });

Hope this helps,
Majd

@mqumseya thank you for your response. The solution you provided does not work. Please advise on how to fix this problem. Thank you.

Hi Melissa,
Can you please provide a link to your site and specify the name of the page so we can inspect?
Roi.

Hi Roi, Please note that the Client Site had to go live on 9/27/18 so I made a workaround for the forgot password. I put a white box and new blue text link to a password reset form. The form goes to me then I manually have to delete the member from the member list, send the user a message with a link to resubmit the New KindCraft Member form.
The website is https://www.kindcraft.org/
When a user clicks on RSVP button on home page, Log in button on footer, or Sign up button on the Get Involved page, the LOGIN lightbox opens. LOGIN Lightbox: User has to “Become a Member” and fill out a custom registration form to get their username and password. After submission of form, the site redirects to the specific eventURL that the person started from or it takes them to /events-wix main page. This redirect was working until I went live. Now on the Get Involved page when a user logs in it does not redirect to the /events-wix page.

Roi, I created a copy of the site and moved the workaround so you can see that nothing happens onClick with forgot password. https://winebrennerdesigns.wixsite.com/website-56 Thank you!

Has anyone figured out a solution to wixUsers.promptForgotPassword(); not working ??

I THINK the api for the PROMPTS is broken. I had code that has been working for months that used wixUserLoginPrompt. Yesterday it stopped working. the API simply does not run! see my post:

I ended up coding a workaround for my problem…

@ Melissa Winebrenner

I believe you have to create a members area on your site before it will work. Even if you do not require a members area you still have to create one in order for forgot password to work.

@mikemoynihan99 Thank you for your reply. Unfortunately, I do have a members log in. It is set to customized form and links to a lightbox.

@melissa-1

To add a Member’s Area:

  1. Click Add on the left side of the Editor.

  2. Click the Members tab.

  3. Click Add to Site .

Has anyone figured out a solution to custom registration form and the wixUsers.promptForgotPassword(); not working??

it works it’s been working on my site for the last 2 months without issue

@mikemoynihan99 what is your site URL?

@mikemoynihan99 you are right it does work! I tested my site and it works. Thank you!

What was the solution? I am having the same problem

@rustyaadams

Please add a new post rather than bumping up an old thread from 2018.

Old thread being closed.

Forgot Password works fine.

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';

$w.onReady(function () {
 $w("#forgotPassword").onClick( (event) => {
    //wixWindow.lightbox.close()
   wixUsers.promptForgotPassword()
   .then( ( ) => {
   //
   } )
    .catch( (err) => {
 let errorMsg = err;  //"The user closed the forgot password dialog"
    });
 });
});

export function loginButton_click(event) {

 let email = $w("#email").value;
 let password = $w("#password").value;

 wixUsers.login(email, password)
   .then( () => {
     console.log("User is logged in");
     wixLocation.to("/account/my-account");
   } )
    .catch( (err) => {
     console.log(err);
     $w("#errorMessage").expand();
   } ); 
}