Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eafef34ccf | ||
|
|
dc89010601 | ||
|
|
cf3b25d6c5 |
@@ -12,7 +12,7 @@
|
||||
prototype/ # 可交互 HTML 原型(纯静态,内置 Mock,双击即用)
|
||||
frontend/ # 正式前端(原生 HTML/CSS/JS,调用后端 API)
|
||||
backend/ # 后端服务(Node.js 原生 http,零依赖)
|
||||
design/ # 飞书白板设计图导出
|
||||
|
||||
```
|
||||
|
||||
### 快速启动
|
||||
@@ -24,7 +24,7 @@ cd backend
|
||||
node server.js
|
||||
```
|
||||
|
||||
预置演示账号:`demo001` / `Gpx@2026`
|
||||
预置演示账号:`demo001` / `Demo@2026`
|
||||
(验证码登录场景,后端会在响应中回传 `devCode` 演示验证码,便于联调)
|
||||
|
||||
2. 启动前端:
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 广汇通 GPX - 商户端登录/注册 后端服务(演示实现)
|
||||
* 商户端登录/注册 后端服务(演示实现)
|
||||
*
|
||||
* PRD:《【登陆/注册】》产品需求说明书(飞书 Wiki)
|
||||
* 技术栈:Node.js 原生 http 模块,零第三方依赖
|
||||
@@ -32,8 +32,8 @@ const CONFIG = {
|
||||
PWD_FAIL_FREEZE_AFTER: 5, // 同 IP 连续密码错误 N 次后冻结
|
||||
PWD_FAIL_FREEZE_MS: 24 * 60 * 60 * 1000, // 冻结时长:至次日(演示用 24h)
|
||||
SEED_ACCOUNTS: [
|
||||
// 预置演示账号:demo001 / Gpx@2026(sha256)
|
||||
{ account: 'demo001', passwordHash: sha256('Gpx@2026'), role: 'merchant', displayId: 'demo001' }
|
||||
// 预置演示账号:demo001 / Demo@2026(sha256)
|
||||
{ account: 'demo001', passwordHash: sha256('Demo@2026'), role: 'merchant', displayId: 'demo001' }
|
||||
]
|
||||
};
|
||||
|
||||
@@ -242,6 +242,6 @@ const server = http.createServer(async (req, res) => {
|
||||
});
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`GPX login/register backend listening on http://localhost:${PORT}`);
|
||||
console.log(`Demo account: demo001 / Gpx@2026`);
|
||||
console.log(`login/register backend listening on http://localhost:${PORT}`);
|
||||
console.log(`Demo account: demo001 / Demo@2026`);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# GPX 商户端登录/注册 - API 回归测试
|
||||
# 商户端登录/注册 - API 回归测试
|
||||
# 前置:后端已启动(node server.js),PORT 默认 3000
|
||||
# 用法:bash regression.sh
|
||||
set -u
|
||||
@@ -45,11 +45,11 @@ check "第二次登录不再静默注册" 0 "$R"
|
||||
if [ "$ISNEW2" = "False" ]; then PASS=$((PASS+1)); echo "✅ 老用户 isNewUser=false"; else FAIL=$((FAIL+1)); echo "❌ isNewUser 预期 False 实际 $ISNEW2"; fi
|
||||
|
||||
echo "========== 3. 账号密码登录 =========="
|
||||
R=$(post /login/password '{"account":"demo001","password":"Gpx@2026"}')
|
||||
R=$(post /login/password '{"account":"demo001","password":"Demo@2026"}')
|
||||
check "正确密码登录成功" 0 "$R"
|
||||
R=$(post /login/password '{"account":"demo001","password":"wrong"}')
|
||||
check "错误密码返回无效登录信息" 1001 "$R"
|
||||
R=$(post /login/password '{"account":"zhangsan@demo001","password":"Gpx@2026"}')
|
||||
R=$(post /login/password '{"account":"zhangsan@demo001","password":"Demo@2026"}')
|
||||
check "子账号(子ID@主ID)可登录" 0 "$R"
|
||||
R=$(post /login/password '{"account":"nosuch","password":"x"}')
|
||||
check "不存在的账号返回无效登录信息" 1001 "$R"
|
||||
@@ -58,7 +58,7 @@ echo "========== 4. IP 冻结(连续错5次) =========="
|
||||
for i in 2 3 4; do post /login/password '{"account":"demo001","password":"bad"}' > /dev/null; done
|
||||
R=$(post /login/password '{"account":"demo001","password":"bad"}')
|
||||
check "第5次错误触发IP冻结" 1002 "$R"
|
||||
R=$(post /login/password '{"account":"demo001","password":"Gpx@2026"}')
|
||||
R=$(post /login/password '{"account":"demo001","password":"Demo@2026"}')
|
||||
check "冻结期间正确密码也无法登录" 1002 "$R"
|
||||
post /password/forgot '{"account":"demo001"}' > /dev/null
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 189 KiB |
+4
-4
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>广汇通 GPX - 商户登录/注册</title>
|
||||
<title>商户登录/注册</title>
|
||||
<link rel="stylesheet" href="css/login.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -107,10 +107,10 @@
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<div>© 2026 <a href="javascript:void(0)">www.gx.gxgcloud.cn</a> <span data-i18n="rights">All Rights Reserved.</span></div>
|
||||
<div>© 2026 <a href="javascript:void(0)">www.example.com</a> <span data-i18n="rights">All Rights Reserved.</span></div>
|
||||
<div>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备15026742号-4</a>
|
||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 44011302000032号</a>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备XXXXXXXX号</a>
|
||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 XXXXXXXX号</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ const I18N = {
|
||||
}
|
||||
};
|
||||
|
||||
let lang = localStorage.getItem('gpx_lang') || 'zh-CN';
|
||||
let lang = localStorage.getItem('login_lang') || 'zh-CN';
|
||||
const t = (k) => (I18N[lang] && I18N[lang][k]) || k;
|
||||
|
||||
function applyLang() {
|
||||
@@ -95,7 +95,7 @@ function renderLangMenu() {
|
||||
div.innerHTML = `<span>${L.flag}</span><span>${L.name}</span>`;
|
||||
div.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
lang = code; localStorage.setItem('gpx_lang', code);
|
||||
lang = code; localStorage.setItem('login_lang', code);
|
||||
applyLang(); toggleLang(false);
|
||||
};
|
||||
menu.appendChild(div);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>广汇通 GPX - 商户登录/注册(可交互原型)</title>
|
||||
<title>商户登录/注册(可交互原型)</title>
|
||||
<style>
|
||||
:root {
|
||||
--primary: #2f54eb;
|
||||
@@ -241,12 +241,12 @@
|
||||
|
||||
<!-- 页脚备案 -->
|
||||
<div class="footer">
|
||||
<div>© 2026 <a href="javascript:void(0)">www.gx.gxgcloud.cn</a> <span data-i18n="rights">All Rights Reserved.</span></div>
|
||||
<div>© 2026 <a href="javascript:void(0)">www.example.com</a> <span data-i18n="rights">All Rights Reserved.</span></div>
|
||||
<div>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备15026742号-4</a>
|
||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 44011302000032号</a>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备XXXXXXXX号</a>
|
||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 XXXXXXXX号</a>
|
||||
</div>
|
||||
<div style="font-size:10.5px;color:#d5d5d5">GRG (HK) CO., LIMITED 牌情参考香港海关 LICENSE FOR OFFSHORE MONEY SERVICE (Section 10, Cap.415)</div>
|
||||
<div style="font-size:10.5px;color:#d5d5d5">Powered by Demo
|
||||
</div>
|
||||
|
||||
<div id="toast"></div>
|
||||
@@ -446,8 +446,8 @@ emailLoginBtn.addEventListener('click', () => {
|
||||
let failCount = 0; const FREEZE_AFTER = 5;
|
||||
accLoginBtn.addEventListener('click', () => {
|
||||
if (failCount >= FREEZE_AFTER) { accError.textContent = t('toastFrozen'); return; }
|
||||
// 演示账号:demo001 / Gpx@2026
|
||||
if (accInput.value === 'demo001' && pwdInput.value === 'Gpx@2026') { failCount = 0; loginOk('demo001', false); accError.textContent = ''; }
|
||||
// 演示账号:demo001 / Demo@2026
|
||||
if (accInput.value === 'demo001' && pwdInput.value === 'Demo@2026') { failCount = 0; loginOk('demo001', false); accError.textContent = ''; }
|
||||
else { failCount++; accError.textContent = failCount >= FREEZE_AFTER ? t('toastFrozen') : t('toastAccErr') + (failCount >= 3 ? `(${failCount}/${FREEZE_AFTER})` : ''); }
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user