Skip to content
Snippets Groups Projects
Commit 0981f513 authored by wyl's avatar wyl
Browse files

UPDATE

parent 2b27ff09
Branches
No related tags found
1 merge request!37UPDATE
...@@ -3,4 +3,4 @@ healthcare: ...@@ -3,4 +3,4 @@ healthcare:
url: jdbc:mysql://localhost:3306/health_care url: jdbc:mysql://localhost:3306/health_care
port: 3306 port: 3306
username: root username: root
password: 472500 password: root
\ No newline at end of file \ No newline at end of file
...@@ -62,61 +62,5 @@ ...@@ -62,61 +62,5 @@
} }
}) })
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> </script>
</html> </html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment