|
@@ -10,6 +10,8 @@ import java.net.URLEncoder;
|
|
|
import java.security.SecureRandom;
|
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -354,13 +356,19 @@ public class AuthenticateController extends BaseController {
|
|
|
}
|
|
|
UserEntity user = authenticateService.doLogin(usercode, password);
|
|
|
if (null != user) {
|
|
|
- if(user.getPdyxq()!=null) {
|
|
|
- Date yxq =Utils.getDateLastTime( user.getPdyxq());
|
|
|
- if(yxq.compareTo(new Date())<=0) {
|
|
|
+ Pattern p = Pattern.compile(Constants.PASSWORD_REGEX);
|
|
|
+ Matcher m = p.matcher(password);
|
|
|
+ SimpleDateFormat s = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ try {
|
|
|
+ Date yxq = Utils.getDateLastTime(s.parse(Constants.PASSWORD_YXQ));
|
|
|
+ //密码复杂度不够并且超出有效期外
|
|
|
+ if(!m.find()&&yxq.compareTo(new Date())<=0) {
|
|
|
bc.addMsg("loginPasswordError", "common", MsgLevel.ERROR);
|
|
|
- return bc;
|
|
|
+ return bc;
|
|
|
}
|
|
|
- }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
processLogin(bc, user);
|
|
|
} else {
|
|
|
bc.addMsg("loginError", "common", MsgLevel.ERROR);
|
|
@@ -440,7 +448,7 @@ public class AuthenticateController extends BaseController {
|
|
|
public BusinessContext changePwd(String userCode, String oldPwd,
|
|
|
String newPwd, Boolean changeByAdmin) {
|
|
|
BusinessContext bc = createBusinessContext();
|
|
|
- Pattern p = Pattern.compile("^(?=.*?[a-zA-Z])(?=.*?\\d)(?=.*?[-`=\\\\\\[\\];',.\\/~!@#$%^&*()_+|{}:<>\"]).{8,}$");
|
|
|
+ Pattern p = Pattern.compile(Constants.PASSWORD_REGEX);
|
|
|
Matcher m = p.matcher(newPwd);
|
|
|
if(!m.find()) {
|
|
|
bc.addMsg("changePwd.changePwd.errStylepwd", "common", MsgLevel.ERROR);
|
|
@@ -451,7 +459,6 @@ public class AuthenticateController extends BaseController {
|
|
|
UserEntity user = l.get(0);
|
|
|
if (changeByAdmin || user.getPassword() != null
|
|
|
&& user.getPassword().equals(Utils.encrypt(oldPwd))) {
|
|
|
- user.setPdyxq(null);
|
|
|
user.setPassword(Utils.encrypt(newPwd));
|
|
|
userService.save(user);
|
|
|
} else {
|