From 03018f161bc85bf206a3580fa8f128b7a37d599c Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Mon, 5 Aug 2024 20:45:37 +0000 Subject: [PATCH] add password confirm to create new container instance --- scripts/index.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/scripts/index.js b/scripts/index.js index 6a79bfd..a74992a 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -193,7 +193,7 @@ class InstanceCard extends HTMLElement { } handleConfigButton () { - if (!this.actionLock && this.status === "stopped") { // if the action lock is false, and the node is stopped, then navigate to the conig page with the node infor in the search query + if (!this.actionLock && this.status === "stopped") { // if the action lock is false, and the node is stopped, then navigate to the config page with the node info in the search query goToPage("config.html", { node: this.node.name, type: this.type, vmid: this.vmid }); } } @@ -349,26 +349,28 @@ async function handleInstanceAdd () { - + - + - + - +

Container Options

- + - + - + + + `; @@ -480,4 +482,14 @@ async function handleInstanceAdd () { templateImage.append(new Option(template.name, template.volid)); } templateImage.selectedIndex = -1; + + const password = d.querySelector("#password"); + const confirmPassword = d.querySelector("#confirm-password"); + + function validatePassword () { + confirmPassword.setCustomValidity(password.value !== confirmPassword.value ? "Passwords Don't Match" : ""); + } + + password.addEventListener("change", validatePassword); + confirmPassword.addEventListener("keyup", validatePassword); }