Hi,
Is there a way, how to import user data into the member’s database, while using the custom registration?
With the current code that I have, all new members are visible in the Contact List and Site Members, but not in my member’s database.
I’m trying to solve the problem here:
Let me also share my code, and if any of you will be able to help, I would very much appreciate it.
- The registration code:
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
$w.onReady(function(){
$w('#register').onClick(function (){
let email = $w('#email').value;
let password = $w('#password').value;
wixUsers.register(email,password)
.then(()=>{
wixWindow.lightbox.close();
wixWindow.openLightbox("Přihlášení");
})
})
})
- The login code:
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
$w.onReady(function () {
$w("#forgotPassword").onClick( (event) => {
wixWindow.lightbox.close()
wixUsers.promptForgotPassword()
.then( ( ) => {
} )
.catch( (err) => {
let errorMsg = err; //"The user closed the forgot password dialog"
});
});
});
export function loginButton_click(event) {
let email = $w("#email").value;
let password = $w("#password").value;
wixUsers.login(email, password)
.then( () => {
console.log("User is logged in");
wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
} )
.catch( (err) => {
console.log(err);
$w("#errorMessage").show();
// You can delete this line if you are not going to add an error message. Use a regular text element set to 'collapse on load' from the Properties Panel.
} );
}
Thank you,
Jakub