From cd9519124284c9493082d400d10478842ea31364 Mon Sep 17 00:00:00 2001 From: Yulong Wang <wangy567@cardiff.ac.uk> Date: Thu, 28 Nov 2024 09:34:43 +0000 Subject: [PATCH] Revert "Merge branch 'wyl' into 'main'" This reverts merge request !37 --- src/main/resources/application-dev.yml | 2 +- .../resources/static/html/superAdminView.html | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index ae3309b..b0f4bde 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,4 +3,4 @@ healthcare: url: jdbc:mysql://localhost:3306/health_care port: 3306 username: root - password: root \ No newline at end of file + password: 472500 \ No newline at end of file diff --git a/src/main/resources/static/html/superAdminView.html b/src/main/resources/static/html/superAdminView.html index 90bcc3c..af3f6a2 100644 --- a/src/main/resources/static/html/superAdminView.html +++ b/src/main/resources/static/html/superAdminView.html @@ -62,5 +62,61 @@ } }) + + var bool; + + // 页é¢åŠ è½½åŽç”ŸæˆéªŒè¯ç + window.onload = function () { + createCode(4); + } + + function createCode(length) { + var code = ""; + var checkCode = document.getElementById("checkCode"); + var codeChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); + for (var i = 0; i < length; i++) { + var charNum = Math.floor(Math.random() * codeChars.length); + code += codeChars[charNum]; + } + if (checkCode) { + checkCode.innerHTML = code; + } + } + + function validateCode() { + var inputCode = document.getElementById("inputCode").value; + var checkCode = document.getElementById("checkCode").innerHTML; + if (!inputCode) { + alert("Please enter the verification code!"); + return false; + } + if (inputCode.toUpperCase() !== checkCode.toUpperCase()) { + alert("Verification code error!"); + createCode(4); + return false; + } + return true; + } + + const form = document.getElementById('loginForm'); + form.addEventListener('submit', function (event) { + event.preventDefault(); + + // 验è¯éªŒè¯ç + if (!validateCode()) { + return; + } + + // 验è¯ç”¨æˆ·å和密ç + const username = document.getElementById('username').value; + const password = document.getElementById('password').value; + + if (username === '2649783657@qq.com' && password === 'admin') { + alert("Login successful! Redirecting..."); + window.location.href = "superAdminView.html"; // æˆåŠŸåŽè·³è½¬ + } else { + alert("Invalid email or password. Please try again."); + } + }); </script> </html> \ No newline at end of file -- GitLab