Browse Source

修改验证超时提示信息。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
807f4a25b3
1 changed files with 16 additions and 22 deletions
  1. 16 22
      src/main/java/com/ekexiu/portal/service/SysService.java

+ 16 - 22
src/main/java/com/ekexiu/portal/service/SysService.java

@ -57,7 +57,7 @@ public class SysService {
57 57
58 58
	private String phoneRetrievePasswordReplaceKey;
59 59
	private String phoneRetrievePasswordContentTemplate;
60
	private long timeLimitWithPhoneRetrievePassword =  60 * 1000;
60
	private long timeLimitWithPhoneRetrievePassword = 3 * 60 * 1000;
61 61
62 62
	private String mailRetrievePasswordContentTemplate;
63 63
	private String mailRetrievePasswordReplaceKey;
@ -323,19 +323,15 @@ public class SysService {
323 323
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext
324 324
				.getCachedObject(state);
325 325
		if (sc == null)
326
			return "state码错误!";
327
//			throw new JfwBaseException("state码错误!");
326
			return "验证超时";
328 327
		if (sc.getExpiredTime() < System.currentTimeMillis())
329
			return "验证超时";
330
//			throw new JfwBaseException("验证超时!");
328
			return "验证超时";
331 329
		try {
332 330
			if (!sc.getKey().equals(mobilePhone)) {
333
				return "手机号与验证手机不匹配";
334
//				throw new JfwBaseException("手机号与验证手机不匹配!");
331
				return "手机号与验证手机不匹配";
335 332
			}
336 333
			if (!sc.getValue().equals(validateCode)) {
337
				return "验证码错误";
338
//				throw new JfwBaseException("验证码错误!");
334
				return "验证码错误";
339 335
			}
340 336
			User user = new User();
341 337
			user.setId(StringUtil.buildUUID());
@ -378,11 +374,11 @@ public class SysService {
378 374
				.getCachedObject(key);
379 375
		if (sc == null) {
380 376
			this.userDao.delete(con, userId);
381
			throw new JfwBaseException("state码错误!");
377
			throw new JfwBaseException("验证超时");
382 378
		}
383 379
		if (sc.getExpiredTime() < System.currentTimeMillis()) {
384 380
			this.userDao.delete(con, userId);
385
			throw new JfwBaseException("验证超时");
381
			throw new JfwBaseException("验证超时");
386 382
		}
387 383
		try {
388 384
			User user = userDao.queryByEmailOrMobilePhone(con, mail);
@ -504,7 +500,7 @@ public class SysService {
504 500
			throws SQLException {
505 501
		User user = userDao.queryByEmailOrMobilePhone(con, lk);
506 502
		if (null == user)
507
			throw new SQLException("该用户还未注册");
503
			throw new SQLException("该用户还未注册");
508 504
		if (DEFAULT_PASS_WORD.equals(user.getPasswd()))
509 505
			return null;
510 506
		if (!StringUtil.md5(pw).equals(user.getPasswd()))
@ -607,8 +603,7 @@ public class SysService {
607 603
			return null;
608 604
		user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
609 605
		if (null != user)
610
			return "该手机号已经绑定用户";
611
//			throw new JfwBaseException("该手机号已经绑定用户!");
606
			return "该手机号已经绑定其他用户";
612 607
613 608
		StateCode<String, String> sc = new StateCode<String, String>();
614 609
@ -726,8 +721,7 @@ public class SysService {
726 721
727 722
		User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
728 723
		if (null == user)
729
			return "该手机号还未注册";
730
//			throw new JfwBaseException("该手机号还未注册!");
724
			return "该手机号还未注册";
731 725
732 726
		StateCode<String, String> sc = new StateCode<String, String>();
733 727
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
@ -768,10 +762,10 @@ public class SysService {
768 762
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext
769 763
				.getCachedObject(state);
770 764
		if (sc == null) {
771
			throw new JfwBaseException("state码错误!");
765
			throw new JfwBaseException("验证超时");
772 766
		}
773 767
		if (sc.getExpiredTime() < System.currentTimeMillis()) {
774
			throw new JfwBaseException("验证超时");
768
			throw new JfwBaseException("验证超时");
775 769
		}
776 770
		return sc.getValue().equals(vc);
777 771
	}
@ -784,10 +778,10 @@ public class SysService {
784 778
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext
785 779
				.getCachedObject(state);
786 780
		if (sc == null) {
787
			return false;
781
			throw new JfwBaseException("验证超时");
788 782
		}
789 783
		if (sc.getExpiredTime() < System.currentTimeMillis()) {
790
			return false;
784
			throw new JfwBaseException("验证超时");
791 785
		}
792 786
		try {
793 787
			if (!sc.getKey().equals(mobilePhone) || !sc.getValue().equals(vc))
@ -857,9 +851,9 @@ public class SysService {
857 851
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext
858 852
				.getCachedObject(state);
859 853
		if (sc == null)
860
			return false;
854
			throw new JfwBaseException("验证超时");
861 855
		if (sc.getExpiredTime() < System.currentTimeMillis())
862
			return false;
856
			throw new JfwBaseException("验证超时");
863 857
		String key = sc.getKey();
864 858
		try {
865 859
			return this.userDao.updatePassword(con, StringUtil.md5(pw), key) > 0;