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.

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:

$w.onReady(function () {

    import { checkPassword } from 'backend/password';

$w("#submitButton").onClick(() => {
    let password = $w("#passwordInput").value;
        .then((result) => {
            if (result) {
            } 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]($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
    // 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)
        .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.