Im trying to validate password, so the new member have to put in the same password twice.
But now with this code the member still can put in two different password and submit. The page will register the "email" and "password" without validate that the passwords are the same in "password" and "password2"
Don't understand why tho,
Any help Is helpful :)
@Alexander Fors
import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; $w.onReady(function(){ $w('#registerNow').onClick(function (){ let email = $w('#mail1').value; let password = $w('#losen1').value; let password2 = $w('#losen2').value; if (password === password2) { //if password matches we console.log success message and register the user console.log("Dem matchar!"); wixUsers.register(email,password) .then(()=>{ wixLocation.to('/testing'); })
} //if password does not match console.log error message else { console.log("Dem matchar inte!"); } }) })
You need to move your wixUsers.register section of your code. It should be placed just after you console.log("Dem matchar"). else should be the last bit of code on your page...