1.完成通过旧密码修改app密码
2.完成通过验证码修改app密码 3.完成app账号信息的修改
Showing
6 changed files
with
31 additions
and
10 deletions
... | @@ -24,8 +24,8 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec | ... | @@ -24,8 +24,8 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec |
24 | Integer updateLastActiveTime(String username); | 24 | Integer updateLastActiveTime(String username); |
25 | 25 | ||
26 | @Modifying | 26 | @Modifying |
27 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) | 27 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1", nativeQuery = true) |
28 | Integer updatePasswordById(Long id, String password); | 28 | Integer updatePasswordByUsername(String username, String password); |
29 | 29 | ||
30 | @Modifying | 30 | @Modifying |
31 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " + | 31 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " + |
... | @@ -33,4 +33,9 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec | ... | @@ -33,4 +33,9 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec |
33 | " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" + | 33 | " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" + |
34 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | 34 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
35 | Integer updateAppInfo(@Param("resources") UserApp resources); | 35 | Integer updateAppInfo(@Param("resources") UserApp resources); |
36 | |||
37 | @Modifying | ||
38 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) | ||
39 | Integer updatePasswordById(Long id, String password); | ||
40 | |||
36 | } | 41 | } | ... | ... |
... | @@ -36,10 +36,10 @@ public class UserAppController { | ... | @@ -36,10 +36,10 @@ public class UserAppController { |
36 | private UserAppBindService userAppBindService; | 36 | private UserAppBindService userAppBindService; |
37 | 37 | ||
38 | @Log | 38 | @Log |
39 | @PostMapping(value = "/updatePasswordById") | 39 | @PostMapping(value = "/updateAppPasswordByUsername") |
40 | @ApiOperation("修改app账号密码") | 40 | @ApiOperation("修改app账号密码") |
41 | @AnonymousAccess | 41 | @AnonymousAccess |
42 | public ResultInfo updatePasswordById(@Validated @RequestBody UserApp resources) { | 42 | public ResultInfo updateAppPasswordByUsername(@Validated @RequestBody UserApp resources) { |
43 | log.info("修改app账号密码,参数 ==>> [updatePassword#{}]", resources); | 43 | log.info("修改app账号密码,参数 ==>> [updatePassword#{}]", resources); |
44 | String username = resources.getUsername(); | 44 | String username = resources.getUsername(); |
45 | if (StringUtils.isBlank(username)) { | 45 | if (StringUtils.isBlank(username)) { |
... | @@ -56,10 +56,10 @@ public class UserAppController { | ... | @@ -56,10 +56,10 @@ public class UserAppController { |
56 | boolean passwordRegexResult = RegexUtil.appPasswordRegex(password); | 56 | boolean passwordRegexResult = RegexUtil.appPasswordRegex(password); |
57 | if (!passwordRegexResult) { | 57 | if (!passwordRegexResult) { |
58 | log.error("修改app账号密码失败,参数错误,密码格式不正确,[updatePassword#{}]", resources); | 58 | log.error("修改app账号密码失败,参数错误,密码格式不正确,[updatePassword#{}]", resources); |
59 | return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-10 之间"); | 59 | return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间"); |
60 | } | 60 | } |
61 | 61 | ||
62 | boolean result = this.userAppService.updatePasswordById(resources); | 62 | boolean result = this.userAppService.updatePasswordByUsername(resources); |
63 | return ResultInfo.success(result); | 63 | return ResultInfo.success(result); |
64 | } | 64 | } |
65 | 65 | ... | ... |
... | @@ -56,6 +56,13 @@ public interface UserAppService { | ... | @@ -56,6 +56,13 @@ public interface UserAppService { |
56 | * @param resources | 56 | * @param resources |
57 | * @return | 57 | * @return |
58 | */ | 58 | */ |
59 | boolean updatePasswordByUsername(UserApp resources); | ||
60 | |||
61 | /** | ||
62 | * | ||
63 | * @param resources | ||
64 | * @return | ||
65 | */ | ||
59 | boolean updatePasswordById(UserApp resources); | 66 | boolean updatePasswordById(UserApp resources); |
60 | 67 | ||
61 | /** | 68 | /** |
... | @@ -64,4 +71,7 @@ public interface UserAppService { | ... | @@ -64,4 +71,7 @@ public interface UserAppService { |
64 | * @return | 71 | * @return |
65 | */ | 72 | */ |
66 | UserAppSimpleDTO updateAppInfo(UserApp resources); | 73 | UserAppSimpleDTO updateAppInfo(UserApp resources); |
74 | |||
75 | |||
76 | |||
67 | } | 77 | } | ... | ... |
... | @@ -96,8 +96,8 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -96,8 +96,8 @@ public class UserAppServiceImpl implements UserAppService { |
96 | 96 | ||
97 | @Override | 97 | @Override |
98 | @Transactional(rollbackFor = Exception.class) | 98 | @Transactional(rollbackFor = Exception.class) |
99 | public boolean updatePasswordById(UserApp resources) { | 99 | public boolean updatePasswordByUsername(UserApp resources) { |
100 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; | 100 | return this.userAppRepository.updatePasswordByUsername(resources.getUsername(), resources.getPassword()) > 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | @Override | 103 | @Override |
... | @@ -122,5 +122,11 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -122,5 +122,11 @@ public class UserAppServiceImpl implements UserAppService { |
122 | return null; | 122 | return null; |
123 | } | 123 | } |
124 | 124 | ||
125 | @Override | ||
126 | @Transactional(rollbackFor = Exception.class) | ||
127 | public boolean updatePasswordById(UserApp resources) { | ||
128 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; | ||
129 | } | ||
130 | |||
125 | 131 | ||
126 | } | 132 | } | ... | ... |
... | @@ -24,7 +24,7 @@ public class RegexUtil { | ... | @@ -24,7 +24,7 @@ public class RegexUtil { |
24 | } | 24 | } |
25 | 25 | ||
26 | public static boolean appPasswordRegex(String password) { | 26 | public static boolean appPasswordRegex(String password) { |
27 | String pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,10}$"; | 27 | String pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,25}$"; |
28 | Pattern r = Pattern.compile(pattern); | 28 | Pattern r = Pattern.compile(pattern); |
29 | Matcher m = r.matcher(password); | 29 | Matcher m = r.matcher(password); |
30 | return m.find(); | 30 | return m.find(); | ... | ... |
... | @@ -64,7 +64,7 @@ | ... | @@ -64,7 +64,7 @@ |
64 | 64 | ||
65 | 65 | ||
66 | <!--监控sql日志输出 --> | 66 | <!--监控sql日志输出 --> |
67 | <logger name="jdbc.sqlonly" level="INFO" additivity="false"> | 67 | <logger name="jdbc.sqlonly" level="OFF" additivity="false"> |
68 | <appender-ref ref="console" /> | 68 | <appender-ref ref="console" /> |
69 | <appender-ref ref="info" /> | 69 | <appender-ref ref="info" /> |
70 | </logger> | 70 | </logger> | ... | ... |
-
Please register or sign in to post a comment