How to set up custom Login button with Code? Urgent help!

Hello!
I really need urgent help in this.
I have created my own Lightbox to be used for users to login. What coding should be used to allow users to login? In order to login, you have to enter your email and password. So, what code is to be used to allow users to login and if the email and password match and are a member in the system, then they successfully login. Otherwise, they get a message that the password and email are incorrect.

I am in desperate need of help. I’ll be waiting for your reply. Thank you!!

@mahreen

something like this…

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$w.onReady( function () {

let email = $w(‘#LoginEmailInput’).value;

let password = $w(‘#LoginPasswordInput’).value;

//login user
wixUsers.login(email, password)

                .then(() => { 

//reload page
wixLocation.to.to(wixLocation.url);

                }) 

})

Thank you so much!!!
I had figured it out eventually but THIS WAS GREAT HELP!!! Could you help me out in creating a logout button because mine doesn’t seem to work? If the user is logged in, I want the button to say Logout. When you click on the button when you are logged in, you logout and go to the homepage. If you are not logged in, the button directs you to the signup page/ login page. My code doesn’t work properly and has parsing errors…