Compare commits
3
Commits
f1f70fce9d
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a459b7700 | ||
|
|
92f517bbab | ||
|
|
b2234f2302 |
@@ -12,7 +12,7 @@
|
|||||||
prototype/ # 可交互 HTML 原型(纯静态,内置 Mock,双击即用)
|
prototype/ # 可交互 HTML 原型(纯静态,内置 Mock,双击即用)
|
||||||
frontend/ # 正式前端(原生 HTML/CSS/JS,调用后端 API)
|
frontend/ # 正式前端(原生 HTML/CSS/JS,调用后端 API)
|
||||||
backend/ # 后端服务(Node.js 原生 http,零依赖)
|
backend/ # 后端服务(Node.js 原生 http,零依赖)
|
||||||
design/ # 飞书白板设计图导出
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 快速启动
|
### 快速启动
|
||||||
@@ -24,7 +24,7 @@ cd backend
|
|||||||
node server.js
|
node server.js
|
||||||
```
|
```
|
||||||
|
|
||||||
预置演示账号:`demo001` / `Gpx@2026`
|
预置演示账号:`demo001` / `Demo@2026`
|
||||||
(验证码登录场景,后端会在响应中回传 `devCode` 演示验证码,便于联调)
|
(验证码登录场景,后端会在响应中回传 `devCode` 演示验证码,便于联调)
|
||||||
|
|
||||||
2. 启动前端:
|
2. 启动前端:
|
||||||
@@ -63,3 +63,7 @@ python3 -m http.server 8080
|
|||||||
| POST | /api/login/verify-code | 验证码登录(含静默注册) |
|
| POST | /api/login/verify-code | 验证码登录(含静默注册) |
|
||||||
| POST | /api/login/password | 账号密码登录(含 IP 冻结控制) |
|
| POST | /api/login/password | 账号密码登录(含 IP 冻结控制) |
|
||||||
| POST | /api/password/forgot | 忘记密码 |
|
| POST | /api/password/forgot | 忘记密码 |
|
||||||
|
|
||||||
|
### 更新记录
|
||||||
|
|
||||||
|
- 2026-10-24:完成一次 SSH 克隆 → 修改 → 推送的完整流程验证。
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* 广汇通 GPX - 商户端登录/注册 后端服务(演示实现)
|
* 商户端登录/注册 后端服务(演示实现)
|
||||||
*
|
*
|
||||||
* PRD:《【登陆/注册】》产品需求说明书(飞书 Wiki)
|
* PRD:《【登陆/注册】》产品需求说明书(飞书 Wiki)
|
||||||
* 技术栈:Node.js 原生 http 模块,零第三方依赖
|
* 技术栈:Node.js 原生 http 模块,零第三方依赖
|
||||||
@@ -32,8 +32,8 @@ const CONFIG = {
|
|||||||
PWD_FAIL_FREEZE_AFTER: 5, // 同 IP 连续密码错误 N 次后冻结
|
PWD_FAIL_FREEZE_AFTER: 5, // 同 IP 连续密码错误 N 次后冻结
|
||||||
PWD_FAIL_FREEZE_MS: 24 * 60 * 60 * 1000, // 冻结时长:至次日(演示用 24h)
|
PWD_FAIL_FREEZE_MS: 24 * 60 * 60 * 1000, // 冻结时长:至次日(演示用 24h)
|
||||||
SEED_ACCOUNTS: [
|
SEED_ACCOUNTS: [
|
||||||
// 预置演示账号:demo001 / Gpx@2026(sha256)
|
// 预置演示账号:demo001 / Demo@2026(sha256)
|
||||||
{ account: 'demo001', passwordHash: sha256('Gpx@2026'), role: 'merchant', displayId: 'demo001' }
|
{ account: 'demo001', passwordHash: sha256('Demo@2026'), role: 'merchant', displayId: 'demo001' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -242,6 +242,6 @@ const server = http.createServer(async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server.listen(PORT, () => {
|
server.listen(PORT, () => {
|
||||||
console.log(`GPX login/register backend listening on http://localhost:${PORT}`);
|
console.log(`login/register backend listening on http://localhost:${PORT}`);
|
||||||
console.log(`Demo account: demo001 / Gpx@2026`);
|
console.log(`Demo account: demo001 / Demo@2026`);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# GPX 商户端登录/注册 - API 回归测试
|
# 商户端登录/注册 - API 回归测试
|
||||||
# 前置:后端已启动(node server.js),PORT 默认 3000
|
# 前置:后端已启动(node server.js),PORT 默认 3000
|
||||||
# 用法:bash regression.sh
|
# 用法:bash regression.sh
|
||||||
set -u
|
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
|
if [ "$ISNEW2" = "False" ]; then PASS=$((PASS+1)); echo "✅ 老用户 isNewUser=false"; else FAIL=$((FAIL+1)); echo "❌ isNewUser 预期 False 实际 $ISNEW2"; fi
|
||||||
|
|
||||||
echo "========== 3. 账号密码登录 =========="
|
echo "========== 3. 账号密码登录 =========="
|
||||||
R=$(post /login/password '{"account":"demo001","password":"Gpx@2026"}')
|
R=$(post /login/password '{"account":"demo001","password":"Demo@2026"}')
|
||||||
check "正确密码登录成功" 0 "$R"
|
check "正确密码登录成功" 0 "$R"
|
||||||
R=$(post /login/password '{"account":"demo001","password":"wrong"}')
|
R=$(post /login/password '{"account":"demo001","password":"wrong"}')
|
||||||
check "错误密码返回无效登录信息" 1001 "$R"
|
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"
|
check "子账号(子ID@主ID)可登录" 0 "$R"
|
||||||
R=$(post /login/password '{"account":"nosuch","password":"x"}')
|
R=$(post /login/password '{"account":"nosuch","password":"x"}')
|
||||||
check "不存在的账号返回无效登录信息" 1001 "$R"
|
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
|
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"}')
|
R=$(post /login/password '{"account":"demo001","password":"bad"}')
|
||||||
check "第5次错误触发IP冻结" 1002 "$R"
|
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"
|
check "冻结期间正确密码也无法登录" 1002 "$R"
|
||||||
post /password/forgot '{"account":"demo001"}' > /dev/null
|
post /password/forgot '{"account":"demo001"}' > /dev/null
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 189 KiB |
+4
-4
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>广汇通 GPX - 商户登录/注册</title>
|
<title>商户登录/注册</title>
|
||||||
<link rel="stylesheet" href="css/login.css">
|
<link rel="stylesheet" href="css/login.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -107,10 +107,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<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>
|
<div>
|
||||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备15026742号-4</a>
|
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备XXXXXXXX号</a>
|
||||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 44011302000032号</a>
|
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 XXXXXXXX号</a>
|
||||||
</div>
|
</div>
|
||||||
</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;
|
const t = (k) => (I18N[lang] && I18N[lang][k]) || k;
|
||||||
|
|
||||||
function applyLang() {
|
function applyLang() {
|
||||||
@@ -95,7 +95,7 @@ function renderLangMenu() {
|
|||||||
div.innerHTML = `<span>${L.flag}</span><span>${L.name}</span>`;
|
div.innerHTML = `<span>${L.flag}</span><span>${L.name}</span>`;
|
||||||
div.onclick = (e) => {
|
div.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
lang = code; localStorage.setItem('gpx_lang', code);
|
lang = code; localStorage.setItem('login_lang', code);
|
||||||
applyLang(); toggleLang(false);
|
applyLang(); toggleLang(false);
|
||||||
};
|
};
|
||||||
menu.appendChild(div);
|
menu.appendChild(div);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>广汇通 GPX - 商户登录/注册(可交互原型)</title>
|
<title>商户登录/注册(可交互原型)</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
--primary: #2f54eb;
|
--primary: #2f54eb;
|
||||||
@@ -241,12 +241,12 @@
|
|||||||
|
|
||||||
<!-- 页脚备案 -->
|
<!-- 页脚备案 -->
|
||||||
<div class="footer">
|
<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>
|
<div>
|
||||||
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备15026742号-4</a>
|
<a href="https://beian.miit.gov.cn/" target="_blank">粤ICP备XXXXXXXX号</a>
|
||||||
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 44011302000032号</a>
|
<a href="https://beian.mps.gov.cn/" target="_blank">粤公网安备 XXXXXXXX号</a>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div id="toast"></div>
|
<div id="toast"></div>
|
||||||
@@ -446,8 +446,8 @@ emailLoginBtn.addEventListener('click', () => {
|
|||||||
let failCount = 0; const FREEZE_AFTER = 5;
|
let failCount = 0; const FREEZE_AFTER = 5;
|
||||||
accLoginBtn.addEventListener('click', () => {
|
accLoginBtn.addEventListener('click', () => {
|
||||||
if (failCount >= FREEZE_AFTER) { accError.textContent = t('toastFrozen'); return; }
|
if (failCount >= FREEZE_AFTER) { accError.textContent = t('toastFrozen'); return; }
|
||||||
// 演示账号:demo001 / Gpx@2026
|
// 演示账号:demo001 / Demo@2026
|
||||||
if (accInput.value === 'demo001' && pwdInput.value === 'Gpx@2026') { failCount = 0; loginOk('demo001', false); accError.textContent = ''; }
|
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})` : ''); }
|
else { failCount++; accError.textContent = failCount >= FREEZE_AFTER ? t('toastFrozen') : t('toastAccErr') + (failCount >= 3 ? `(${failCount}/${FREEZE_AFTER})` : ''); }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
本地没有端到底要怎么打开git和运行呀
|
||||||
Reference in New Issue
Block a user