{"record":{"id":"04679c91438da00c","repo":"paascloud/paascloud-master","slug":"uac10011029","errorCode":"UAC10011029","errorMessage":"重置密码失败","messagePattern":"重置密码失败","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java","lineNumber":717,"sourceCode":"\t\t}\n\n\t\tLoginAuthDto loginAuthDto = new LoginAuthDto();\n\t\tloginAuthDto.setUserName(uacUser.getUserName());\n\t\tloginAuthDto.setLoginName(uacUser.getLoginName());\n\t\tloginAuthDto.setUserId(uacUser.getId());\n\n\t\tUacUser update = new UacUser();\n\t\tString salt = generateId() + \"\";\n\t\tupdate.setLoginPwd(Md5Util.encrypt(newPassword));\n\t\tupdate.setSalt(salt);\n\t\tupdate.setId(uacUser.getId());\n\t\t// 该用户已经修改过密码\n\t\tupdate.setIsChangedPwd((Short.valueOf(\"1\")));\n\t\tupdate.setUpdateInfo(loginAuthDto);\n\n\t\tint result = uacUserMapper.updateByPrimaryKeySelective(update);\n\t\tif (result < 1) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011029);\n\t\t}\n\t\tredisTemplate.delete(resetPwdTokenKey);\n\t}\n\n\t@Override\n\t@Transactional(readOnly = true, rollbackFor = Exception.class)\n\tpublic UserBindRoleVo getUserBindRoleDto(Long userId) {\n\t\tUserBindRoleVo userBindRoleVo = new UserBindRoleVo();\n\t\tSet<Long> alreadyBindRoleIdSet = Sets.newHashSet();\n\t\tUacUser uacUser = this.queryByUserId(userId);\n\t\tif (uacUser == null) {\n\t\t\tlogger.error(\"找不到userId={}, 的用户\", userId);\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011003, userId);\n\t\t}\n\n\t\t// 查询所有角色包括该用户拥有的角色\n\t\tList<BindRoleDto> bindRoleDtoList = uacUserMapper.selectAllNeedBindRole(GlobalConstant.Sys.SUPER_MANAGER_ROLE_ID);\n\t\t// 该角色已经绑定的用户","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java#L699-L735","documentation":"UAC10011029 (message '重置密码失败' — reset password failed) is thrown when uacUserMapper.updateByPrimaryKeySelective(update) affects fewer than 1 rows during the token-based password reset, i.e. the UPDATE to set the new password did not modify any row. The token was valid in Redis, but persisting the new password failed.","triggerScenarios":"Calling resetLoginPwdByRestPwdKey(resetPwdKey, newPassword, confirmNewPassword) where the user record identified by the token's stored user id no longer exists or was concurrently modified/deleted between Redis token validation and the DB update.","commonSituations":"User account deleted while a reset token was outstanding; DB connectivity/transaction failures; primary-key mismatch between the user object cached in Redis and current table state; concurrent password changes invalidating the row.","solutions":["Re-check that the user id embedded in the reset token still exists in uac_user; if deleted, invalidate the token and ask the user to re-register/re-request","Retry the reset with a fresh token after confirming the account exists","Inspect DB/transaction logs for update failures (connection, lock timeout)","Catch UacBizException code UAC10011029 and surface a generic 'reset failed, please try again' with a new reset link"],"exampleFix":"// before\nuacUserService.resetLoginPwdByRestPwdKey(token, newPwd, confirmPwd);\n// after\ntry {\n    uacUserService.resetLoginPwdByRestPwdKey(token, newPwd, confirmPwd);\n} catch (UacBizException e) {\n    if (\"UAC10011029\".equals(e.getCode())) {\n        // invalidate token and prompt user to request a new reset link\n    }\n}","handlingStrategy":"try-catch","validationCode":"if (uacUserService.queryByUserId(userIdFromToken) == null) { /* account gone: invalidate token, request new reset */ }","typeGuard":null,"tryCatchPattern":"try { uacUserService.resetLoginPwdByRestPwdKey(key, newPwd, confirmPwd); } catch (UacBizException e) { if (\"UAC10011029\".equals(e.getCode())) { /* generic 'reset failed', offer new reset link */ } }","preventionTips":["Verify the token's user still exists before attempting the update","Monitor DB transaction/connection failures on the update path","Invalidate stale tokens when accounts are deleted"],"tags":["password-reset","update-failed","database"],"backgroundTag":"database-write-failed","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}