|
@ -2,6 +2,8 @@ package com.ekexiu.portal.service;
|
2
|
2
|
|
3
|
3
|
import java.sql.Connection;
|
4
|
4
|
import java.sql.SQLException;
|
|
5
|
import java.text.SimpleDateFormat;
|
|
6
|
import java.util.Date;
|
5
|
7
|
import java.util.HashMap;
|
6
|
8
|
import java.util.Map;
|
7
|
9
|
import java.util.Random;
|
|
@ -34,6 +36,7 @@ import com.ekexiu.portal.pojo.SessionUser;
|
34
|
36
|
@Path
|
35
|
37
|
public class SysService {
|
36
|
38
|
public static final String DEFAULT_PASS_WORD = "11111111111111111111111111111111";
|
|
39
|
public static SimpleDateFormat DATE = new SimpleDateFormat("yyyyMMddHHmmss");
|
37
|
40
|
|
38
|
41
|
@Autowrie
|
39
|
42
|
private UserDao userDao;
|
|
@ -601,22 +604,15 @@ public class SysService {
|
601
|
604
|
ret.setAuth(true);
|
602
|
605
|
return ret;
|
603
|
606
|
}
|
604
|
|
|
|
607
|
|
605
|
608
|
@Post
|
606
|
609
|
@Path("/cp")
|
607
|
610
|
public boolean changePw(@JdbcConn(true) Connection con, String id, String npw, @Nullable String onw) throws SQLException {
|
608
|
|
User user = this.userDao.query(con, id);
|
609
|
|
if (user == null)
|
610
|
|
return false;
|
611
|
611
|
if (onw == null) {
|
612
|
|
if (!DEFAULT_PASS_WORD.equals(user.getPasswd()))
|
613
|
|
return false;
|
|
612
|
return this.userDao.updatePasswdAndActive(con, StringUtil.md5(npw), DATE.format(new Date()), id) > 0;
|
614
|
613
|
} else {
|
615
|
|
if (!StringUtil.md5(onw).equals(user.getPasswd()))
|
616
|
|
return false;
|
|
614
|
return this.userDao.updatePasswd(con, StringUtil.md5(npw), id, StringUtil.md5(onw)) > 0;
|
617
|
615
|
}
|
618
|
|
this.userDao.updatePassword(con, StringUtil.md5(npw), id);
|
619
|
|
return true;
|
620
|
616
|
}
|
621
|
617
|
|
622
|
618
|
@Get
|
|
@ -854,7 +850,11 @@ public class SysService {
|
854
|
850
|
try {
|
855
|
851
|
if (!sc.getKey().equals(mobilePhone) || !sc.getValue().equals(vc))
|
856
|
852
|
return false;
|
857
|
|
return this.userDao.updatePasswordWithMobileOrEmail(con, StringUtil.md5(pw), mobilePhone) > 0;
|
|
853
|
int ret = this.userDao.updatePasswdWithMobile(con, StringUtil.md5(pw), DATE.format(new Date()), mobilePhone);
|
|
854
|
if (ret == 0) {
|
|
855
|
return this.userDao.updatePasswordWithMobileOrEmail(con, StringUtil.md5(pw), mobilePhone) > 0;
|
|
856
|
}
|
|
857
|
return ret > 0;
|
858
|
858
|
} finally {
|
859
|
859
|
JfwAppContext.removeCachedObject(state);
|
860
|
860
|
}
|
|
@ -914,7 +914,11 @@ public class SysService {
|
914
|
914
|
throw new JfwBaseException("验证超时");
|
915
|
915
|
String key = sc.getKey();
|
916
|
916
|
try {
|
917
|
|
return this.userDao.updatePassword(con, StringUtil.md5(pw), .format(new Date()), key) > 0;
|
|
917
|
int ret = this.userDao.updatePasswdAndActive(con, StringUtil.md5(pw), DATE.format(new Date()), .format(new Date()), key);
|
|
918
|
if (ret == 0) {
|
|
919
|
return this.userDao.updatePassword(con, StringUtil.md5(pw), key) > 0;
|
|
920
|
}
|
|
921
|
return ret > 0;
|
918
|
922
|
} finally {
|
919
|
923
|
JfwAppContext.removeCachedObject(state);
|
920
|
924
|
}
|