Merge branch 'prod/20251229' into feature/gongfu
# Conflicts: # nflg-mobilebroken-cfs-app/src/main/java/com/nflg/mobilebroken/cfs/controller/UserController.java
This commit is contained in:
commit
c3589983f9
|
|
@ -133,7 +133,8 @@ public class UserController extends ControllerBase {
|
||||||
String email = AppUserUtil.getEmail();
|
String email = AppUserUtil.getEmail();
|
||||||
String kaptcha = RandomUtil.randomString(6);
|
String kaptcha = RandomUtil.randomString(6);
|
||||||
// 将生成的验证码存入redis
|
// 将生成的验证码存入redis
|
||||||
stringRedisTemplate.opsForValue().set(StrUtil.format(Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_APP, email), kaptcha, Duration.ofHours(72));
|
String key = StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_APP) ? Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_APP : Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_ADMIN;
|
||||||
|
stringRedisTemplate.opsForValue().set(StrUtil.format(key, email), kaptcha, Duration.ofHours(72));
|
||||||
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_CHANGE_PASSWORD, Constant.DEFAULT_LANGUAGE_CODE);
|
String subject = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_TITLE_ACCOUNT_CHANGE_PASSWORD, Constant.DEFAULT_LANGUAGE_CODE);
|
||||||
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_ACCOUNT_CHANGE_PASSWORD, Constant.DEFAULT_LANGUAGE_CODE)
|
String content = dictionaryItemTranslateService.getValueByCode(Constant.DICTIONARY_EMAIL_NOTIFY, Constant.DICTIONARY_ITEM_EMAIL_CONTENT_ACCOUNT_CHANGE_PASSWORD, Constant.DEFAULT_LANGUAGE_CODE)
|
||||||
.replace("${loginName}", email)
|
.replace("${loginName}", email)
|
||||||
|
|
@ -152,11 +153,16 @@ public class UserController extends ControllerBase {
|
||||||
**/
|
**/
|
||||||
@PostMapping("updatePassword")
|
@PostMapping("updatePassword")
|
||||||
public ApiResult<Void> updatePassword(@Valid @RequestBody UpdatePasswordRequest request) {
|
public ApiResult<Void> updatePassword(@Valid @RequestBody UpdatePasswordRequest request) {
|
||||||
String redisKey = StrUtil.format(Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_APP, AppUserUtil.getEmail());
|
String key = StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_APP) ? Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_APP : Constant.REDIS_KEY_USER_UPDATE_KAPTCHA_ADMIN;
|
||||||
|
String redisKey = StrUtil.format(key, AppUserUtil.getEmail());
|
||||||
String captcha = stringRedisTemplate.opsForValue().get(redisKey);
|
String captcha = stringRedisTemplate.opsForValue().get(redisKey);
|
||||||
VUtils.trueThrowBusinessError(StrUtil.isBlank(captcha)).throwMessage("验证码已失效,请重新获取");
|
VUtils.trueThrowBusinessError(StrUtil.isBlank(captcha)).throwMessage("验证码已失效,请重新获取");
|
||||||
VUtils.trueThrowBusinessError(!StrUtil.equals(captcha, request.getCaptcha())).throwMessage("验证码不正确");
|
VUtils.trueThrowBusinessError(!StrUtil.equals(captcha, request.getCaptcha())).throwMessage("验证码不正确");
|
||||||
|
if (StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_APP)) {
|
||||||
appUserService.updatePassword(AppUserUtil.getUserId(), request.getNewPassword());
|
appUserService.updatePassword(AppUserUtil.getUserId(), request.getNewPassword());
|
||||||
|
} else if (StrUtil.equals(AppUserUtil.getFrom(), Constant.FROM_ADMIN)) {
|
||||||
|
adminUserService.updatePassword(AppUserUtil.getUserId(), request.getNewPassword());
|
||||||
|
}
|
||||||
stringRedisTemplate.delete(redisKey);
|
stringRedisTemplate.delete(redisKey);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue