Normalize phone input and default user phone

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-04-28 20:08:21 +08:00
parent 581990a52f
commit 1e52fd04af
4 changed files with 23 additions and 24 deletions
+2 -4
View File
@@ -14,10 +14,9 @@ import (
)
func login(ctx *gin.Context) {
area := ctx.PostForm("area")
user := ctx.PostForm("user")
pass := ctx.PostForm("pass")
if area == "" || user == "" || pass == "" {
if user == "" || pass == "" {
ctx.JSON(http.StatusOK, webuischema.Msg{
Code: 1,
Message: "参数不完整!",
@@ -26,10 +25,9 @@ func login(ctx *gin.Context) {
return
}
userName := " " + area + "-" + user
var userId int
exists, err := db.UserEng.Table("users").
Where("phone = ? AND password = ?", userName, openssl.Md5ToString(pass)).
Where("phone = ? AND password = ?", user, openssl.Md5ToString(pass)).
Cols("user_id").Get(&userId)
utils.CheckErr(err)
if !exists {