I want to create a custom login page and then check the database for email and password on a members website. Can anyone help me with the code?
Yes it is possible!
And you will surely find a lot of examples here in this forum.
Or also take a look here…
old one, but could help you to understand…
https://russian-dima.wixsite.com/meinewebsite/blank-9
or here…
https://russian-dima.wixsite.com/meinewebsite/user-infos
or here…
https://russian-dima.wixsite.com/meinewebsite/automatic-registration
Yes its very easy to do so. Go to pages then sign up and login then click on settings for login or sign up then select custom sign up or login. then create your own custom login page.
you may use this as example
www.aviantstudios .shop (my site)
I don’t want to use velo code as I am only familiar with javascript, php, and html
Velo-Code = JavaScript (or better sayed VELO is based on JS)
Only PHP is not supported as i know.
I am using the following code I found on You Tube:
import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;
$w . onReady ( () => {
if ( wixUsers . currentUser . loggedIn ) {
$w ( “#button4” ). label = “Logout” ;
$w ( “#button5” ). show ();
}
else {
$w ( “#button4” ). label = “Login” ;
$w ( “#button5” ). hide ();
}
} );
export function button4_onclick () {
// user is logged in
if ( wixUsers . currentUser . loggedIn ) {
// log the user out
wixUsers . logout ()
. then ( () => {
// update buttons accordingly
$w ( “#button4” ). label = “Login” ;
$w ( “#button5” ). hide ();
} );
}
// user is logged out
else {
let userId ;
let userEmail ;
// prompt the user to log in
wixUsers . promptLogin ( { “mode” : “login” } )
. then ( ( user ) => {
userId = user . id ;
return user . getEmail ();
} )
. then ( ( email ) => {
// check if there is an item for the user in the collection
userEmail = email ;
return wixData . query ( “MemberProfile” )
. eq ( “_id” , userId )
. find ();
} )
. then ( ( results ) => {
// if an item for the user is not found
if ( results . items . length === 0 ) {
// create an item
const toInsert = {
“_id” : userId ,
“email” : userEmail
};
// add the item to the collection
wixData . insert ( “MemberProfile” , toInsert )
. catch ( ( err ) => {
console . log ( err );
} );
}
// update buttons accordingly
$w ( “#button4” ). label = “Logout” ;
$w ( “#button5” ). show ();
} )
. catch ( ( err ) => {
console . log ( err );
} );
}
}
export function button5_onclick () {
wixLocation . to ( /MemberProfile/Update/ ${ wixUsers . currentUser . id }
);
}
As I am only using 1 button, 2 text boxes and a checkbox; what should the code like?
To be continued…
Problem already solved? If not, please provide the link to the Youtube-Video and eventually put more informations to your issue.