Hi, I’m creating a login system for my website. I have been searching a lot but couldn’t find anything helping. So, I created a dataset which includes two columns: ID and Password. Now I’m trying to compare two inputs with the respective fields from dataset.
Here’s what I have so far:
import wixData from 'wix-data';
import wixLocation from 'wix-location';
console.log("Openinng : Signin Lightbox");
let password = $w('#sorbonnePassword').value;
let userName = $w('#sorbonneId').value;
//since id and password are texts, should I replace " .value " with something else?
export function signInButton_click(event, $w) {
console.log("Establishing Connection with Dataset");
wixData.query("MemberAccounts")
.eq('sorbonneIdentity', userName)
.eq('sorbonnePassword', password)
.find()
.then((result) => {
if (result.items.length > 0) {
console.log("Credentials Found");
wixLocation.to("/my-account/${results.items[0]._id}")
} else {
$w("#errorMessage").show();
console.log("Credentials Not Found");
}
})
.catch(err => {
console.log("Unable to access collection: " + err)
})
}
Here are some screenshots from the console panel.
Below is an image after I filled in the credentials and clicked on the sign-in button.
After clicking, logs don’t seem to show. Does this mean that the button isn’t working at all?
Also, please let me know of any better approach to create a sign-in page using credentials.
Thanks.