Can anone tell me how gto set up a password reset page with code from my login page?
This is the code I use to do this, using the promptForgotPassword function, which takes them to the standard reset password page.
$w.onReady(function () {
$w('#forgotpassword').onClick((event) => {
wixUsers.promptForgotPassword()
.then(() => {
console.log("Password reset submitted");
})
.catch((err) => {
console.log(err);
});
});
});
Do I put this code after the login function code?
@niallmagner The order doesn’t matter too much in this case since both pieces are executed independently on button clicks, but it should go within your current onReady function like so
$w.onReady(function(){
// your current login click code goes here
$w('#loginNow').onClick((event)=>{
//etc
})
// then the password code
$w('#forgotpassword').onClick((event)=>{
wixUsers.promptForgotPassword()
.then(()=>{
console.log("Password reset submitted");
})
.catch((err)=>{
console.log(err);
});
});
});
I need to set up a database. How do I link the login systemm to the members database?
From my understanding they should already be linked if you left the default fields there. Otherwise you can do this in code - https://www.wix.com/velo/reference/wix-users/register