I created a custom lightbox login for members, and I used the login() code from https://www.wix.com/corvid/reference/wix-users/login . However, when I click the submit button, instead of the login function checking against my profile database for email and password, it creates a new profile.
I want the code to check against my profile database → logs in users → redirect to another page if successful. Help! And thank you!
import wixUsers from ‘wix-users’ ;
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’ ;
export function loginButton_onclick(event) {
let email = $w( “#email” ).value;
let password = $w( “#password” ).value;
wixUsers.login(email, password)
.then( () => {
console.log( “User is logged in” );
wixWindow.lightbox.close();
wixLocation.to( ‘/member’ );
} )
. catch ( (err) => {
console.log(err);
} );
}