Is there anyway to create my own members login page without using Wix’s? At the same time still be able to assign various pages to members-only access.
Ofcourse, just add textboxes for email and password, then a button and then when button is clicked use wixUsers.login and send values into that. After successful login redirect to any member site.
“then a button and then when button is clicked use wixUsers.login and send values into that”
how do i do that?
do i get the code from here (https://www.wix.com/code/reference/wix-users.html)? Then paste it in the page code?
Paste this code
import wixUsers from 'wix-users';
let email = $w("#email"); // YOUR FIELDS
let password = $w("#password");
// THE BELOW IN THE BUTTON CLICK EVENT
wixUsers.login(email, password)
.then( () => {
console.log("User is logged in");
// DO YOUR STUFF
} )
.catch( (err) => {
console.log(err);
} );
Thanks Andreas!
I’ve changed my email and password according to the input name (#input1 & #input2)
Like this:
import wixUsers from ‘wix-users’;
let email = $w(“#input1”); // YOUR FIELDS
let password = $w(“#input2”);
// THE BELOW IN THE BUTTON CLICK EVENT
wixUsers.login(email, password)
.then( () => {
console.log(“User is logged in”);
// DO YOUR STUFF
} )
. catch ( (err) => {
console.log(err);
} );
What else do you think I’ve missed out? I’ve also created a button (#button1).
In the button click event onClick this code should be…
wixUsers.login(email, password) .then( () => { console.log("User is logged in"); // DO YOUR STUFF } ) .catch( (err) => { console.log(err); } );