Trying to validate email and password on login page, but getting errors. Help !!

import wixData from 'wix-data';

export function Loginbutton_click(onClick, $w) {
  $w("#Loginemail").onCustomValidation((value, reject) => {
 
 if (value.length === 0) {
 //if the input field is blank > show an error by
 
    } else {
 
 let validationMessage = '';
 // if its not blank > searches the database table
      wixData.query('Login')
        .eq('email', $w('#Loginemail').value)
        .find()
 //if it finds an email in the eMail column of your DB
 // that equals whats in the #userinputEmail input box
 // then it runs the next if loop ↓↓
        .then(results => {
 if (results.length === 0) {
 //  means email not found in DB
              validationMessage += 'Email not found\n';
            } else if (results.items[0].password =$w('#Loginpassword').value) {
 // if it is, this is where you would check the value of #userinputPassword
 //  against the value of the password in the database and if they match
 // set user as logged in and make magic
            } else {
              validationMessage += 'Please enter a valid password\n';
 // if they dont match give them an error
 //send them back to login
            $w('#publishtextlogin').text = validationMessage;
            $w('#publishtextlogin').expand();  //try again
            }
          }
        )}$w('#publishtextlogin').collapse();
  });
}

Duplicated post as already answered here.
https://www.wix.com/corvid/forum/community-discussion/created-a-login-page-but-having-trouble-matching-email-and-confirm-password-help