Browse Source

no message

xingzai 7 months ago
parent
commit
366fe10e7d
1 changed files with 16 additions and 10 deletions
  1. 16 10
      controllers/user.go

+ 16 - 10
controllers/user.go

@@ -55,6 +55,10 @@ func (this *UserCommonController) Login() {
 
 	password := req.Password
 	loginType := req.LoginType
+	if utils.ValidateMobileFormatat(mobile) {
+		br.Msg = "格式错误,请输入正确的手机号码。"
+		return
+	}
 
 	if loginType == "2" { // 单独处理密码登录
 		if password == "" {
@@ -75,11 +79,6 @@ func (this *UserCommonController) Login() {
 			return
 		}
 
-		if utils.ValidateMobileFormatat(mobile) {
-			br.Msg = "格式错误,请输入正确的手机号码。"
-			return
-		}
-
 		//专栏作者,但是还没设置登录密码,弹窗提示如下:
 		isSetPassword := services.GetIsSetPassword(mobile)
 		if !isSetPassword {
@@ -1983,6 +1982,10 @@ func (this *UserCommonController) SetPass() {
 		br.ErrMsg = "Password 为空"
 		return
 	}
+	if utils.ValidateMobileFormatat(mobile) {
+		br.Msg = "格式错误,请输入正确的手机号码。"
+		return
+	}
 
 	item, err := models.GetMsgCode(req.Mobile, req.VCode)
 	if err != nil {
@@ -2063,6 +2066,10 @@ func (this *UserController) UpdatePass() {
 	}
 	oldPassword := req.OldPassword
 	newPassword := req.NewPassword
+	if utils.ValidateMobileFormatat(mobile) {
+		br.Msg = "格式错误,请输入正确的手机号码。"
+		return
+	}
 
 	total, err := models.GetCygxUserPasswordCountByMobileAdnPss(mobile, oldPassword)
 	if err != nil {
@@ -2126,6 +2133,10 @@ func (this *UserCommonController) ReSetPass() {
 		br.ErrMsg = "Password 为空"
 		return
 	}
+	if utils.ValidateMobileFormatat(mobile) {
+		br.Msg = "格式错误,请输入正确的手机号码。"
+		return
+	}
 
 	item, err := models.GetMsgCode(req.Mobile, req.VCode)
 	if err != nil {
@@ -2157,11 +2168,6 @@ func (this *UserCommonController) ReSetPass() {
 		return
 	}
 
-	if utils.ValidateMobileFormatat(mobile) {
-		br.Msg = "格式错误,请输入正确的手机号码。"
-		return
-	}
-
 	isSetPassword := services.GetIsSetPassword(mobile)
 	if isSetPassword {
 		err = models.UpdateCygxUserPassword(mobile, password)