Files
SI_TEALab_2025_LabWebsite/dofile/test_login.html
T
pengxiao a3eb5c7b2d init: TEALab 2025 实验室网站项目
从百度网盘 /apps/bypy/dofile/ 下载的完整项目结构,包含:
- dofile/: Flask 后端(端口 5000)+ 静态前端(端口 6002)
- officefile/: 项目相关文档
- .gitignore: Python venv / 日志 / 缓存

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-14 01:07:19 +08:00

51 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Test Login</title>
</head>
<body>
<h1>Login Test</h1>
<button onclick="testLogin()">Test Login</button>
<div id="result"></div>
<script>
async function testLogin() {
const resultDiv = document.getElementById('result');
resultDiv.innerHTML = 'Testing...';
try {
const response = await fetch('http://localhost:5000/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
body: JSON.stringify({
username: 'admin',
password: 'admin123'
})
});
const data = await response.json();
resultDiv.innerHTML = `
<h3>Status: ${response.status}</h3>
<pre>${JSON.stringify(data, null, 2)}</pre>
`;
} catch (error) {
resultDiv.innerHTML = `<p style="color: red;">Error: ${error.message}</p>`;
}
}
</script>
</body>
</html>