|
@@ -260,6 +260,8 @@ func (this *UserLoginController) Login() {
|
|
VerifyCode string `description:"验证码"`
|
|
VerifyCode string `description:"验证码"`
|
|
ReqTime string `description:"登录时间戳"`
|
|
ReqTime string `description:"登录时间戳"`
|
|
TelAreaCode string `description:"区号"`
|
|
TelAreaCode string `description:"区号"`
|
|
|
|
+ CaptchaId string `description:"验证码ID"`
|
|
|
|
+ CaptchaCode string `description:"图形验证码"`
|
|
}
|
|
}
|
|
var req UserLoginReq
|
|
var req UserLoginReq
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
@@ -290,6 +292,21 @@ func (this *UserLoginController) Login() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 获取基本配置信息
|
|
|
|
+ picVerifyConfInfo, e := models.GetBusinessConfByKey(models.BusinessConfLoginPictureVerifyCode)
|
|
|
|
+ if e != nil && !utils.IsErrNoRow(e) {
|
|
|
|
+ br.Msg = "查询配置信息失败"
|
|
|
|
+ br.ErrMsg = e.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if picVerifyConfInfo != nil && picVerifyConfInfo.ConfVal == "1" {
|
|
|
|
+ if req.CaptchaCode == "" || req.CaptchaId == ""{
|
|
|
|
+ br.Msg = "请输入验证码"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 判断账号是否为异常登录, 算作异常的话就需要换另外的方式去登录了
|
|
// 判断账号是否为异常登录, 算作异常的话就需要换另外的方式去登录了
|
|
abnormalKey := fmt.Sprint(utils.CACHE_ABNORMAL_LOGIN, req.Username)
|
|
abnormalKey := fmt.Sprint(utils.CACHE_ABNORMAL_LOGIN, req.Username)
|
|
isAbnormal, _ := utils.Rc.RedisString(abnormalKey)
|
|
isAbnormal, _ := utils.Rc.RedisString(abnormalKey)
|
|
@@ -299,6 +316,16 @@ func (this *UserLoginController) Login() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 校验图形验证码
|
|
|
|
+ if picVerifyConfInfo != nil && picVerifyConfInfo.ConfVal == "1" {
|
|
|
|
+ store := services.CaptchaRedis{}
|
|
|
|
+ ok := store.Verify(req.CaptchaId, req.CaptchaCode, true)
|
|
|
|
+ if !ok {
|
|
|
|
+ br.Msg = "图形验证码错误, 请重新输入"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 查询账号信息
|
|
// 查询账号信息
|
|
errPassKey := fmt.Sprint(utils.CACHE_LOGIN_ERR_PASS, req.Username)
|
|
errPassKey := fmt.Sprint(utils.CACHE_LOGIN_ERR_PASS, req.Username)
|
|
accountUser, e := system.GetSysUserByAdminName(req.Username)
|
|
accountUser, e := system.GetSysUserByAdminName(req.Username)
|
|
@@ -1014,7 +1041,7 @@ func (this *UserLoginController) BaseInfo() {
|
|
|
|
|
|
configKeys := []string{
|
|
configKeys := []string{
|
|
"ICPLicense", "ETATitle", "TabName", "LogoCN", "LogoEN", "LogoCNMini", "LogoENMini", "LoginLeftImg",
|
|
"ICPLicense", "ETATitle", "TabName", "LogoCN", "LogoEN", "LogoCNMini", "LogoENMini", "LoginLeftImg",
|
|
- "ETASubTitleCN", "ETASubTitleEN",
|
|
|
|
|
|
+ "ETASubTitleCN", "ETASubTitleEN","IsLoginPictureVerifyCode",
|
|
}
|
|
}
|
|
configOb := new(models.BusinessConf)
|
|
configOb := new(models.BusinessConf)
|
|
list, e := configOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "")
|
|
list, e := configOb.GetItemsByCondition(``, make([]interface{}, 0), []string{}, "")
|