Hi, I am using an custom form registration provided by Wix,
The issue I am having, is that it doesn’t automatically log the user after the account was made.
Here is my code : what do i need to add ?*
// Custom 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;
let firstName = $w(‘#firstName’).value;
let lastName = $w(‘#lastName’).value;
let phone = $w(‘#mainPhone’).value;
wixUsers.register(email, password, {
contactInfo: {
“firstName”: firstName,
“lastName”: lastName,
“phones”: [phone]
}
})
.then((result)=>{
wixLocation.to('/home');
})
})
})
You need to create both your custom login and signup forms in lightboxes and then setup your custom signup settings to be from those lightboxes.
https://support.wix.com/en/article/corvid-enabling-custom-site-registration
Plus you need to make sure that you have setup your approval so that members are approved immediately or manually.
https://support.wix.com/en/article/approving-a-site-member
https://support.wix.com/en/article/editing-your-member-signup-settings-for-the-default-form
You need to create both your custom login and signup forms in lightboxes and then setup your custom signup settings to be from those lightboxes.
https://support.wix.com/en/article/corvid-enabling-custom-site-registration
Plus you need to make sure that you have setup your approval so that members are approved immediately or manually.
https://support.wix.com/en/article/approving-a-site-member
https://support.wix.com/en/article/editing-your-member-signup-settings-for-the-default-form
This is my own signup lightbox code and it works perfectly and closes after registering details before moving onto my signup status page.
Then both names will be saved in contacts and once the new site member is approved the member details will be added to ‘members’ database.
import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#registerButton").onClick( (event) => {
let email = $w("#email").value;
let password = $w("#password").value;
let first = $w("#firstName").value;
let last = $w("#lastName").value;
wixUsers.register(email, password, {
contactInfo: {
"firstName": $w('#firstName').value,
"lastName": $w('#lastName').value,
}
} )
.then( (result) => {
let resultStatus = result.status;
wixWindow.lightbox.close();
wixLocation.to("/sign-in-status"); //Change the URL ending to whatever page you want to send the user to after they log in.
} );
} );
});