I’m having a lot of issues with my custom registration form. I must gather certain info from users before they can can become a site member. I created a custom registration form that is connected to a database, as well as my CRV. The form looks like this…
This is the code for form is this…
import wixUsers from ‘wix-users’;
import wixLocation from “wix-location”;
$w.onReady( function () {
$w('#register').onClick(() => {
wixUsers.register($w('#email').value, $w('#password').value, {
“contactInfo”: {
“credentials”: $w(‘#Credentials’).value,
“practice”: $w(‘#Practice’).value,
“stateProvince”: $w(‘#StateProvince’).value,
“country”: $w(‘#Country’).value
}
})
.then(() => {
console.log('user registered successfully');
wixLocation.to('https://www.therapaw.com');
}) }) })
The form is working properly. I receive a notification when a new member fills it out. I also created a separate lightbox for existing members to log in. It is linked to a different database that records every time a user logs into the site. (See below)
However, many people who are already existing members seem to be filling out the “New Member Registation” form instead. When this happens, I don’t receive a notification, nor does it log them in because the “email” and “password” input fields are connected to a log in. It’s becoming a big problem because they are unaware that they have an existing account and, because we don’t receive a notification, we don’t know that they are trying to log in.
I think there are two ways of solving this problem.
#1 when an existing member enters their info and clicks “register” it triggers a message telling them that they already have an account.
#2 would be that the “email” and “password” input fields on the “New Member Registration” form have a dual purpose:
A. to register new users as pending members and notify us.
B. to log in existing members and trigger message or lightbox that says " you are already logged in"
Can you please tell me how to change my code to allow the “email” and “password” fields to both register people and log them in, if they are members? Please help!!!
Johanna