Password Protect Page Given by me - then Enter next page

Hey Everyone - I am trying to create a manual password protected page.

  • the home page (which requires a password from me)
  • they enter the key given by me and enter on “password input”
  • if password is correct it will redirect them to the next page.

https://igawiktoriapietrzak.wixsite.com/talent-verse-2

How can I best achieve this here is what I’ve done so far

  • turned Dev Mode
  • dragged the label "input password’ to the home page
  • change id of label password to ID # “passwordInput”
// Velo API Reference: https://www.wix.com/velo/reference/api-overview/introduction

$w.onReady(function () {

    import { checkPassword } from 'backend/password';

$w("#submitButton").onClick(() => {
    let password = $w("#passwordInput").value;
    checkPassword(password)
        .then((result) => {
            if (result) {
                wixLocation.to("/next-page");
            } else {
                $w("#errorMessage").text = "Incorrect password.";
            }
        });
});

/**
*   Adds an event handler that runs when an element is displayed
 in the viewable part of the current window.
    [Read more](https://www.wix.com/corvid/reference/$w.ViewportMixin.html#onViewportEnter)
*    @param {$w.Event} event
*/
export function section1_viewportEnter(event) {
    // This function was added from the Properties & Events panel. To learn more, visit http://wix.to/UcBnC-4
    // Add your code for this event here: 
}

then went to public & backend

  • add new js.file
  • named password.js

Here’s the code

import wixData from 'wix-data';

export function checkPassword(password) {
    return wixData.query("Password")
        .eq("password", password)
        .find()
        .then(res => {
            if (res.items.length > 0) {
                return true;
            } else {
                return false;
            }
        });
}

Thank you for your support and help!

The other issue is - Where do I add the password? like to help the function understand which password is required.