paascloud/paascloud-master · error · UacBizException

UAC10011030

UAC10011030

Error message

激活失败, 链接已过期

What it means

UAC10011030 is thrown by the user-activation flow (activeUser) when redisService.getKey(getActiveUserKey(activeUserToken)) returns null/empty. The registration flow stores the user's email in Redis under the activation token with a TTL; once the TTL expires (or the key was flushed), activation cannot map the token back to an email and fails with 'link expired'.

Solutions

  1. Ask the user to re-register or use the 'resend activation email' flow so a fresh token/key is written to Redis.
  2. Increase the activation TTL when setting the key (e.g. redisService.setKey(activeUserKey, email, longerTimeout)) or persist the token in DB as a fallback.
  3. Confirm the app issuing the email and the app handling activation point at the same Redis database/prefix (check spring.redis config and RedisKeyUtil.getActiveUserKey).
  4. Enable Redis persistence (appendonly/AOF) or avoid flushing the shared instance so tokens survive restarts.

Example fix

// before
redisService.setKey(activeUserKey, email);
// after
redisService.setKey(activeUserKey, email, 7, TimeUnit.DAYS); // longer than email validity
Defensive patterns

Strategy: try-catch

Validate before calling

String email = redisService.getKey(RedisKeyUtil.getActiveUserKey(token));
if (StringUtils.isEmpty(email)) {
    return Result.fail("activation link expired, please re-register or resend the email");
}

Try / catch

try {
    uacUserService.activeUser(activeUserToken);
} catch (UacBizException e) {
    if ("UAC10011030".equals(e.getCode())) { return Result.fail(410, "activation link expired"); }
    throw e;
}

Prevention

When it happens

Trigger: User clicks the email activation link after the Redis TTL has elapsed; Redis restart/eviction removed the key; the token in the URL was truncated or never issued (wrong redis key prefix).

Common situations: Delayed email reading (activation links older than the TTL, commonly 24h); shared/ephemeral Redis in dev with default no-persistence config; environments pointing at different Redis instances so the key saved at registration is missing at activation.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/fdd82e7d1c460362. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java:759

			alreadyBindRoleIdSet.add(uacRoleUser.getRoleId());
		}

		userBindRoleVo.setAllRoleSet(allUserSet);
		userBindRoleVo.setAlreadyBindRoleIdSet(alreadyBindRoleIdSet);

		return userBindRoleVo;
	}

	@Override
	public void activeUser(String activeUserToken) {
		Preconditions.checkArgument(!StringUtils.isEmpty(activeUserToken), "激活用户失败");

		String activeUserKey = RedisKeyUtil.getActiveUserKey(activeUserToken);

		String email = redisService.getKey(activeUserKey);

		if (StringUtils.isEmpty(email)) {
			throw new UacBizException(ErrorCodeEnum.UAC10011030);
		}
		// 修改用户状态, 绑定访客角色
		UacUser uacUser = new UacUser();
		uacUser.setEmail(email);

		uacUser = uacUserMapper.selectOne(uacUser);
		if (uacUser == null) {
			logger.error("找不到用户信息. email={}", email);
			throw new UacBizException(ErrorCodeEnum.UAC10011004, email);
		}

		UacUser update = new UacUser();
		update.setId(uacUser.getId());
		update.setStatus(UacUserStatusEnum.ENABLE.getKey());
		LoginAuthDto loginAuthDto = new LoginAuthDto();
		loginAuthDto.setUserId(uacUser.getId());
		loginAuthDto.setUserName(uacUser.getLoginName());
		loginAuthDto.setLoginName(uacUser.getLoginName());

View on GitHub (pinned to 781281a950)