// means email not found in DB
import wixData from ‘wix-data’ ;
export function LoginButton_click ( event , $w ) {
$w( “#inputemail” ).onCustomValidation((value, reject) => {
if (value.length === 0 ) {
// this is validating the input field
//if the input field is blank > show an error by
//showing a hidden text or an alert or however you want
} else {
// if its not blank > searches the database table
wixData.query( ‘Registration’ )
.eq( ‘email’ , $w( ‘#inputemail’ ).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 ) {
$w( “#LoginError” ).show();
} else if (results.items[ 0 ].password === $w( ‘#inputPassword’ ).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 {
// if they dont match give them an error
//send them back to login
//try again
$w( “#LoginError” ).show();
}
}
);
}
});
}
Can anyone please help on the above issue. I struggling on the same issue since a couple of weeks.
Issue: when i press login button with blank user input(email, password) there are no errors showing .
Login button is working with out validating any error message. Please correct me. I am new the wix code. I appreciate needful help at earliest
This is unsafe.
Let Corvid handle the passwords.
Google “wix corvid custom login page” and you’ll find lots of information on how to implement this correctly.
As Brainstorrrm has said above, never keep records of users passwords in a dataset on your site, you are responsible for any security issues that may arise if you not and you will be liable and not Wix etc.
Also, don’t post an issue on the Corvid Forum and bump it up when only about 15mins has gone past.
You need to give it at least a day (24 hours) as Wix Admin, Wix Mods, Corvid Masters and Corvid Ninjas are all around the globe and are all on at diferent times, so give it a suitable length of time for it to be answered as you won’t always get a reply immediately if nobody is on to answer.
If you want to do a simple validation, just get the user to input the password twice.
You can see Wix example here about validation.
https://www.wix.com/corvid/example/custom-validations
https://support.wix.com/en/article/corvid-about-validating-user-input-with-code
https://support.wix.com/en/article/working-with-user-input-validation-in-the-settings-panel
If you use the search in this forum too, you will find many old posts about validation as well.
I agree, Thanks for correction both
I understood, thanks for correction