@Override public void deleteByUserId(Long UserId, String token) { Map<String, Object> map = new HashMap<String, Object>(); map.put("UserId", UserId); map.put("token", token); userForgetPassDao.deleteByUserId(map); }
@Override public void insert(String email) { String encodeString = encoder.encode(email + UUID.randomUUID().toString()); List<User> list = null; Long userId = null; // Calendar c = Calendar.getInstance(); // long time = c.getTimeInMillis(); // String token_exptime=(time+1000*20)+"";//获取超时时间 // 获取发邮件链接超时间隔时间 Config config = null; config = configDao.selectByConfigName("email_effetime"); String effectime = (config == null) ? "0" : config.getConfigValue(); int effectimeIn = Integer.parseInt(effectime); Timestamp token_exptime = new Timestamp(System.currentTimeMillis() + effectimeIn * 60 * 1000); list = userDao.selectByEmail(email); // 获取用户id if (list != null) { userId = list.get(0).getId(); } ResetPassRequest resetPassRequest = new ResetPassRequest(); resetPassRequest.setUserId(userId); resetPassRequest.setCertificateCode(encodeString); resetPassRequest.setValidTo(token_exptime); // 保存找回密码链接信息 userForgetPassDao.insert(resetPassRequest); this.sendResetPasswordEmail(encodeString, email); }
@Override public List<ResetPassRequest> selectByCodeAndUser(String certificateCode) { Map<String, Object> map = new HashMap<String, Object>(); map.put("certificateCode", certificateCode); return userForgetPassDao.selectByCodeAndUser(map); }