提示词节奏准则+群聊/朋友圈限长; 解密降级防500
This commit is contained in:
+7
-1
@@ -12,7 +12,13 @@ def enc(key: bytes | None, text: str) -> str:
|
||||
|
||||
def dec(key: bytes | None, stored: str) -> str:
|
||||
from ..core.security import decrypt_text
|
||||
return decrypt_text(key, stored) if key else stored
|
||||
if not key:
|
||||
return stored
|
||||
try:
|
||||
return decrypt_text(key, stored)
|
||||
except Exception:
|
||||
# 密码重置/盐变更导致的旧密文:降级显示,不让整个请求 500
|
||||
return "[旧加密内容已失效]"
|
||||
|
||||
|
||||
class UserRepo:
|
||||
|
||||
Reference in New Issue
Block a user