I have created a simple "Custom Log In / Sign On Screen" using the code below.
Works fine, but it seems the catch error is not working, because nothing happens when typing wrong email/password. The error message is still hidden.
But when typing in correct info, it works fine.
What is wrong, any idea?
Thanks:-)
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"); //Change the URL ending to whatever page you want to send the user to after they log in.
} )
.catch( (err) => {
console.log(err);
$w("#errorMessage").expand(); // You can delete this line if you are not going to add an error message. Use a regular text element set to 'collapse on load' from the Properties Panel.
} );
}
Your code looks fine so the problem is probably somewhere else.
It's hard to guess. Maybe you made the text message hidden on load instead of collapsed (or something else).
yes i had that same issue i hope someone can fix that issue