fix: 统一管理后台 401 与加载失败处理
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"errors"
|
||||
"net/http"
|
||||
"unicode/utf8"
|
||||
|
||||
"git.asio.asia/nixevol/NixMsg/internal/auth"
|
||||
"git.asio.asia/nixevol/NixMsg/internal/httpx"
|
||||
@@ -127,7 +128,7 @@ func (h *Handler) handlePassword(w http.ResponseWriter, r *http.Request) {
|
||||
writeDecodeError(w, err)
|
||||
return
|
||||
}
|
||||
if len(req.NewPassword) < minPasswordLen {
|
||||
if utf8.RuneCountInString(req.NewPassword) < minPasswordLen {
|
||||
h.audit(actorString(p), "password_change", "", "bad_request", ip)
|
||||
httpx.WriteError(w, http.StatusBadRequest, "bad_request", "新密码至少 12 位")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user