feat: 密码强度多级校验 — low/medium/high/very_high

- site_settings 新增 password.strength 配置项
- 四级:low(len>=8) / medium(两类) / high(三类+无连续) / very_high(四类+无连续)
- 连续字符检查:重复/升序/降序/键盘水平/键盘垂直序列
- 注册和改密接口统一读取配置
- 前端 register.js 动态校验 + 管理后台安全设置区
This commit is contained in:
2026-06-22 00:54:21 +08:00
parent e9b7401dc9
commit 9a496d3055
8 changed files with 225 additions and 11 deletions

View File

@ -166,6 +166,16 @@ func (s *SiteSettings) ForceGuidelines() bool {
return s.GetBool("registration.force_guidelines", true)
}
// PasswordStrength 密码强度级别
func (s *SiteSettings) PasswordStrength() string {
level := s.Get("password.strength", "medium")
switch level {
case "low", "medium", "high", "very_high":
return level
}
return "medium"
}
// GuidelinesTimer 强制阅读倒计时秒数
func (s *SiteSettings) GuidelinesTimer() int {
val := s.Get("registration.guidelines_timer", "60")