更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-14
View File
@@ -13,16 +13,6 @@ import (
beego "github.com/beego/beego/v2/server/web"
)
// =============================================================
// 微信公众号敏感字段(AppSecret / EncodingAESKey)的对称加密与掩码
//
// yz_platform_wechat_mp_config.app_secret / aes_key 以 AES-256-GCM 加密后存储,
// 格式:base64( "YZW1:" + nonce + ciphertext )。
// 密钥来源:app.conf 的 wechat_mp_secret_key(任意长度字符串,内部做 SHA-256 派生);
// 未配置时退回内置兜底密钥(保证开箱可用),上线前建议在 app.conf 配置该值。
// 注意:更换密钥后,历史密文将无法解密,需要重新保存一次配置。
// =============================================================
const (
cipherPrefix = "YZW1:"
fallbackSecretKey = "yunzer_wechat_mp_default_secret_key_v1"
@@ -37,7 +27,6 @@ func configKey() []byte {
return sum[:]
}
// EncryptSecret 加密敏感字段;空串原样返回
func EncryptSecret(plain string) (string, error) {
if plain == "" {
return "", nil
@@ -60,7 +49,6 @@ func EncryptSecret(plain string) (string, error) {
return base64.StdEncoding.EncodeToString(buf), nil
}
// DecryptSecret 解密敏感字段;空串原样返回
func DecryptSecret(encoded string) (string, error) {
if encoded == "" {
return "", nil
@@ -89,7 +77,6 @@ func DecryptSecret(encoded string) (string, error) {
return string(plain), nil
}
// MaskSecret 生成掩码:保留末 4 位
func MaskSecret(v string) string {
if v == "" {
return ""
@@ -100,7 +87,6 @@ func MaskSecret(v string) string {
return "******" + v[len(v)-4:]
}
// IsMasked 判断前端回传的值是否仍是掩码(表示「不修改原值」)
func IsMasked(v string) bool {
return strings.HasPrefix(v, "******")
}