From ba2be1af06f6e5360beda68d09289201b547dbef Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Sun, 27 Sep 2020 20:13:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BE=E5=9B=9E=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrauth/controller/UserLoginController.java | 1 + .../service/impl/UserLoginServiceImpl.java | 18 +++++++++++------- .../src/main/resources/jwt.properties | 3 +-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java index 0793eb4e..80c2720e 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java @@ -1,6 +1,7 @@ package com.daqing.financial.hrauth.controller; import com.daqing.financial.hrauth.service.UserLoginService; +import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java index 33d3e1de..7d5332ed 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java @@ -1,6 +1,5 @@ package com.daqing.financial.hrauth.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.daqing.financial.hrauth.dao.UserLoginDao; import com.daqing.financial.hrauth.service.UserLoginService; @@ -53,7 +52,7 @@ public class UserLoginServiceImpl extends ServiceImpl public Boolean getBackPwd(UserLoginRequest user){ //判断重置密码参数是否为空 if(StringUtils.isEmpty(user.getPhoneAccount())){ - ExceptionCast.cast(HrmsCode.PHNOE_ACCOUNT_ILLEGAL); + ExceptionCast.cast(HrmsCode.PHNOE_ACCOUNT_NOT_EMPTY); } if(StringUtils.isEmpty(user.getVerifyCode())){ ExceptionCast.cast(HrmsCode.VERIFY_CODE_ILLEGAL); @@ -62,15 +61,20 @@ public class UserLoginServiceImpl extends ServiceImpl ExceptionCast.cast(HrmsCode.NEW_PASSWORD_NOT_EMPTY); } //校验手机账号是否存在 - int count = this.count(new QueryWrapper() - .eq("phone_account", user.getPhoneAccount())); +/* int count = this.count(new QueryWrapper() + .eq("phone_account", user.getPhoneAccount()));*/ + + int count = userLoginDao.selectCount(user.getPhoneAccount()); if (count == 0) { - ExceptionCast.cast(HrmsCode.PHNOE_ACCOUNT_ILLEGAL); + ExceptionCast.cast(HrmsCode.PHNOE_ACCOUNT_NOT_EMPTY); } //判断验证码是否匹配 - + String verify = "123456"; + if(!verify.equals(user.getVerifyCode())){ + ExceptionCast.cast(HrmsCode.VERIFY_CODE_ILLEGAL); + } //密码格式校验 - Pattern pattern = Pattern.compile("^[a-zA-Z0-9]{8,20}$"); + Pattern pattern = Pattern.compile("^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$"); Matcher match = pattern.matcher(user.getNewPwd()); if(!match.matches()){ ExceptionCast.cast(HrmsCode.NEW_PASSWORD_ILLEGAL); diff --git a/dq-govern-gateway/src/main/resources/jwt.properties b/dq-govern-gateway/src/main/resources/jwt.properties index f1383c49..d8152474 100644 --- a/dq-govern-gateway/src/main/resources/jwt.properties +++ b/dq-govern-gateway/src/main/resources/jwt.properties @@ -1,2 +1 @@ -jwt.ignoreUrlList=/api/hrms/employee/list,/apiHrmsAuth/hrms/auth/userlogin/login -jwt.ignoreUrlList=/apiHrmsAuth/getBackPwd, \ No newline at end of file +jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,/apiHrmsAuth/hrms/auth/userlogin/login