Commit 84c1d09dd8562678c3a40091f5ec2c0671f419f8
Merge branch '20200305' into 'master'
refactor: 密码找回 See merge request huang/thingsboard3.3.2!57
Showing
5 changed files
with
9 additions
and
7 deletions
... | ... | @@ -43,6 +43,7 @@ public enum ErrorMessage { |
43 | 43 | CONVERT_JS_IS_ALONE(400024,"转换脚本只能启用一个"), |
44 | 44 | PHONE_OR_EMAIL_HAS_REGISTER(400025,"手机或邮箱已被使用"), |
45 | 45 | CONTACT_ALREADY_ASSOCIATED(400026,"当前联系人已被设备配置关联"), |
46 | + MSG_CODE_NOT_MATCHED(400027,"验证码不正确"), | |
46 | 47 | HAVE_NO_PERMISSION(500002,"没有修改权限"); |
47 | 48 | private final int code; |
48 | 49 | private String message; | ... | ... |
... | ... | @@ -14,6 +14,7 @@ import javax.validation.Valid; |
14 | 14 | import javax.validation.constraints.NotEmpty; |
15 | 15 | import java.time.Instant; |
16 | 16 | import java.time.LocalDateTime; |
17 | +import java.time.ZoneId; | |
17 | 18 | import java.time.ZoneOffset; |
18 | 19 | import java.util.Optional; |
19 | 20 | import java.util.UUID; |
... | ... | @@ -64,7 +65,7 @@ public class DeviceProfileDTO extends TenantDTO { |
64 | 65 | |
65 | 66 | public DeviceProfileDTO(UUID id, String name, Long time, String description, DeviceTransportType transportType, UUID defaultRuleChainId,boolean isDefault,String image,DeviceProfileType type,Object profileData) { |
66 | 67 | setId(id.toString()); |
67 | - setCreateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.UTC)); | |
68 | + setCreateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8"))); | |
68 | 69 | this.name = name; |
69 | 70 | this.isDefault = isDefault; |
70 | 71 | this.image = image; |
... | ... | @@ -78,7 +79,7 @@ public class DeviceProfileDTO extends TenantDTO { |
78 | 79 | |
79 | 80 | public DeviceProfileDTO(UUID id, String name, Long time, String description, DeviceTransportType transportType, String defaultRuleChainId,boolean isDefault,String image,DeviceProfileType type, String convertJs) { |
80 | 81 | setId(id.toString()); |
81 | - setCreateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.UTC)); | |
82 | + setCreateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneOffset.of("+8"))); | |
82 | 83 | this.name = name; |
83 | 84 | this.isDefault = isDefault; |
84 | 85 | this.image = image; | ... | ... |
... | ... | @@ -59,6 +59,7 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap |
59 | 59 | sceneLinkageDTO.setTenantId(tenantId); |
60 | 60 | // 第一步保存场景,获取场景ID |
61 | 61 | // 场景对象 |
62 | + sceneLinkageDTO.setStatus(0); | |
62 | 63 | SceneLinkage sceneLinkage = sceneLinkageDTO.getEntity(SceneLinkage.class); |
63 | 64 | // 新增 |
64 | 65 | int insert = sceneLinkageMapper.insert(sceneLinkage); | ... | ... |
... | ... | @@ -143,6 +143,7 @@ public class YtNoticeServiceImpl implements YtNoticeService { |
143 | 143 | private void sms4Alarm(AlarmInfoDTO alarmInfo,String templateId, Organization organization,List<AlarmContact> contacts){ |
144 | 144 | SmsReqDTO info = new SmsReqDTO(); |
145 | 145 | info.setId(templateId); |
146 | + info.setTemplatePurpose(MsgTemplatePurposeEnum.FOR_ALARM_NOTICE.name()); | |
146 | 147 | LinkedHashMap<String, String> params = new LinkedHashMap<>(); |
147 | 148 | //name-其他;device_name-其他;level-其他;location-其他;alarm_value-其他; |
148 | 149 | params.put("type", alarmInfo.getType()); |
... | ... | @@ -186,6 +187,7 @@ public class YtNoticeServiceImpl implements YtNoticeService { |
186 | 187 | info.setBody(body); |
187 | 188 | info.setEmailFormatEnum(EmailFormatEnum.TEXT.name()); |
188 | 189 | info.setId(templateId); |
190 | + info.setTemplatePurpose(MsgTemplatePurposeEnum.FOR_ALARM_NOTICE.name()); | |
189 | 191 | |
190 | 192 | mailService.sendEmail(info); |
191 | 193 | } | ... | ... |
... | ... | @@ -461,13 +461,10 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> |
461 | 461 | }) |
462 | 462 | .orElse(false); |
463 | 463 | if (!correct) { |
464 | - throw new BadCredentialsException("验证码不正确"); | |
464 | + throw new YtDataValidationException(ErrorMessage.MSG_CODE_NOT_MATCHED.getMessage()); | |
465 | 465 | } |
466 | 466 | String pwd = forget.getPassword(); |
467 | - if (StringUtils.isEmpty(pwd) | |
468 | -// || StringUtils.isEmpty(forget.getResetPassword()) | |
469 | -// || !pwd.equals(forget.getResetPassword()) | |
470 | - ) { | |
467 | + if (StringUtils.isEmpty(pwd)) { | |
471 | 468 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
472 | 469 | } |
473 | 470 | ... | ... |