i wanted to connect my custom sign up form to my own database, a few while ago it worked just fine and now its not. People signed up but after their data got submitted to my database, they didn't automatically signed up to the website, at that point is where i'm confused. Supposedly visitors would automatically signed up to the web after they sign up, but now it doesn't and they can't log in even though supposedly the log in database takes the info from sign up database.
Does this have anything to do with the privatemembers database? I'm very sure it wasn't there a few while ago. If yes, how do i make it so the sign up and login form logs people in by my own database and not private members database?
Here is my code for custom sign up.
import wixUsers from 'wix-users'; import wixWindow from 'wix-window'; import wixLocation from 'wix-location'; $w.onReady(function () { $w("#register").onClick( (event) => { let email = $w("#email").value; let password = $w("#password").value; wixUsers.register(email, password, { } ) .then( (result) => { let resultStatus = result.status; wixWindow.lightbox.close(); wixLocation.to.to("/welcome"); //Change the URL ending to whatever page you want to send the user to after they log in. } ); } ); });
And here is my custom log in code
import wixUsers from 'wix-users'; import wixLocation from 'wix-location'; $w.onReady(function(){ $w('#login').onClick(function (){ let email = $w('#loginEmail').value; let password = $w('#loginPassword').value; wixUsers.login(email,password) .then(()=>{ wixLocation.to('/registration'); }) }) })
Very simple, just use the right code in your login lightbox. If you are wanting to redirect your user onto another page after they login then simply do that in the code.
wixLocation.to("/account/my-account");
Or whatever page URL that you want the user to go to on your site.
If you are wanting the user to stay on the same page that the lightbox appeared on then just use this code.
wixLocation.to(wixLocation.url);
This will refresh the page that the user was on already, so if you don't need the page to be refreshed then just simply take out this line and have the lightbox close only.
All depends on how you have your site member approval set up, manual then you have to approve themselves, automatically then they become site members immediately.
https://support.wix.com/en/article/approving-a-site-member
https://support.wix.com/en/article/request-receiving-email-notifications-for-automatically-approved-new-site-members
https://support.wix.com/en/article/editing-your-member-signup-settings-for-the-default-form
If Site Members is configured for automatic approval, the register() function returns a status of "Active"and the user becomes an active member of the site.
If Site Members is configured for manual approval, the register() function returns a status of "Pending" and the user becomes a pending member of the site. In order to activate a pending user, the site owner can approve the user manually, using the Contacts application or you can call the approveByToken() or approveByEmail() functions.
https://www.wix.com/corvid/reference/wix-users.html#register