From 60f1adbe01d5dba68c64d6861a5a55b4ed27f6d4 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 11 Aug 2026 18:24:54 +0800 Subject: [PATCH] =?UTF-8?q?pccs=20v1.0:=20gateway.dspy=20login=20=E2=80=94?= =?UTF-8?q?=20fresh=20filename=20avoids=20cached=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/index.html | 2 +- wwwroot/pccs/api/{member.dspy => gateway.dspy} | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) rename wwwroot/pccs/api/{member.dspy => gateway.dspy} (97%) diff --git a/wwwroot/index.html b/wwwroot/index.html index 80f5f64..99f5c6c 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -102,7 +102,7 @@ async function doLogin(){ if(!u||!p){document.getElementById('login-msg').textContent='请输入用户名和密码';return} var fd=new FormData();fd.append('username',u);fd.append('password',p); try{ - var r=await fetch('/pccs/api/member.dspy',{method:'POST',body:fd}); + var r=await fetch('/pccs/api/gateway.dspy',{method:'POST',body:fd}); var d=await r.json(); if(d.status==='ok'){closeLogin();document.getElementById('login-msg').textContent=''} else document.getElementById('login-msg').textContent=d.message||'登录失败' diff --git a/wwwroot/pccs/api/member.dspy b/wwwroot/pccs/api/gateway.dspy similarity index 97% rename from wwwroot/pccs/api/member.dspy rename to wwwroot/pccs/api/gateway.dspy index 2d74fdc..5c359b7 100644 --- a/wwwroot/pccs/api/member.dspy +++ b/wwwroot/pccs/api/gateway.dspy @@ -1,4 +1,4 @@ -# pccs member auth endpoint +# pccs login import hashlib as _hl, datetime as _dt username = params_kw.get('username', '') @@ -12,12 +12,10 @@ async with db.sqlorContext('pccs') as sor: recs = await sor.R('users', {'username': username}) if not recs: return {'status': 'error', 'message': '用户名或密码错误'} - user = recs[0] pw_hash = _hl.sha256(password.encode()).hexdigest() if pw_hash != (user.password or ''): return {'status': 'error', 'message': '用户名或密码错误'} - await sor.U('users', {'id': user.id}, { 'last_login': _dt.datetime.now().isoformat(), 'login_fail_count': 0 })