I do two types of login
1- Login for people whose data is saved in And this login I have no problem with it ( Private Members Data )
2- Corporate login
And this type of login, I do not want it to be in the same database with people. I want to have a database independent of people. Is there a way to implement that?
My Code For people login
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
import wixData from 'wix-data';
let registration;
$w.onReady(function () {
$w("#forgotPassword").onClick((event) => {
wixUsers.promptForgotPassword()
.then(() => {
//
})
.catch((err) => {
let errorMsg = err;
});
});
if (wixUsers.currentUser.loggedIn) {
wixWindow.lightbox.close()
wixWindow.openLightbox('loadingPageT');
}
$w("#password").onKeyPress((event) => {
let key = event.key;
$w('#errorMessage').hide();
$w('#emailExists').hide();
if (key === "Enter") {
console.log("Pressed Enter key on Password field"); //You can change the text of this line or delete it
if ($w("#email").valid && $w("#password").valid && $w("#fname").valid && $w("#lastName").valid) {
let email = $w("#email").value;
let password = $w("#password").value;
let first = $w("#fname").value;
let last = $w("#lastName").value;
wixUsers.register(email, password, {
contactInfo: {
"firstName": first,
"lastName": last
}
})
.then((result) => {
wixWindow.lightbox.close()
wixWindow.openLightbox('loadingPageT');
})
.catch((err) => {
let errorMsg = err;
console.log(errorMsg);
$w('#emailExists').show();
});
} else {
console.log("Some inputs are invalid"); //You can change the text of this line or delete it
$w('#errorMessage').show();
}
} else {
console.log("Did not press Enter key."); //You can change the text of this line or delete it
}
});
$w("#registerButton").onClick((event) => {
console.log("Button was clicked"); //You can change the text of this line or delete it
$w('#errorMessage').hide(); //We want to hide all error messages when the person attempts to register again
$w('#emailExists').hide(); //We want to hide all error messages when the person attempts to register again
if ($w("#email").valid && $w("#password").valid && $w("#fname").valid && $w("#lastName").valid) {
registerPerson();
console.log("Trying to register"); //You can change the text of this line or delete it
} else {
$w('#errorMessage').show(); //This is were we prompt the message to show up again ONLY if there is an error
console.log("Missing information"); //You can change the text of this line or delete it
}
});
});
function registerPerson() {
let email = $w("#email").value;
let password = $w("#password").value;
let first = $w("#fname").value;
let last = $w("#lastName").value;
wixUsers.register(email, password, {
contactInfo: {
"firstName": first,
"lastName": last
}
})
.then((result) => {
wixWindow.lightbox.close()
wixWindow.openLightbox('loadingPageT');
})
.catch((err) => {
let errorMsg = err;
console.log(err);
$w('#emailExists').show(); //This is were we prompt the message to show up again ONLY if there is an error
});
}
I need code for Corporate login the data is stored in another database, not a Private Members Data database
any help PLZ @Velo-Ninja