paascloud/paascloud-master · error · UacBizException

UAC10011019

UAC10011019

Error message

UAC10011019

What it means

EmailServiceImpl.sendEmailCode throws UacBizException(UAC10011019) when a selectCountByExample finds more than zero UacUser rows with the given email whose loginName differs from the current user's. This means the email is already bound to another account, so sending a bind/verification email code is refused.

Solutions

  1. Choose an email not already bound to another loginName
  2. Unbind the email from the other account first (update uac_user.email for that account)
  3. Merge the two accounts if they belong to the same person
  4. Show a clear UI message that the email is already in use by another account

Example fix

// before
emailService.sendEmailCode("alice", "shared@corp.com"); // fails, bob owns the email
// after
if (userService.countByEmailExcludingLogin(email, loginName) == 0) { emailService.sendEmailCode(loginName, email); }
Defensive patterns

Strategy: validation

Validate before calling

int count = userService.countByEmailExcludingLogin(email, loginName); // SELECT COUNT(*) FROM uac_user WHERE email=? AND login_name<>?
if (count > 0) { /* pick another email before calling sendEmailCode */ }

Try / catch

try { emailService.sendEmailCode(loginName, email); } catch (UacBizException e) { if (ErrorCodeEnum.UAC10011019.getCode().equals(e.getCode())) { ui.show("该邮箱已被其他账号绑定"); return; } throw e; }

Prevention

When it happens

Trigger: Calling sendEmailCode to bind a new email for user X while another user Y already has that same email recorded in uac_user.

Common situations: Users sharing a work email across accounts; re-registering an account with an email previously bound; typos matching someone else's email; merging accounts.

Related errors


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

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/EmailServiceImpl.java:105

	@Override
	public void sendEmailCode(SendEmailMessage sendEmailMessage, String loginName) {
		Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), "用户名不能为空");
		String email = sendEmailMessage.getEmail();

		Preconditions.checkArgument(StringUtils.isNotEmpty(email), ErrorCodeEnum.UAC10011018.msg());
		Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), ErrorCodeEnum.UAC10011007.msg());

		// 解密
		email = decryptEmail(loginName, email);

		Example example = new Example(UacUser.class);
		Example.Criteria criteria = example.createCriteria();
		criteria.andEqualTo("email", email);
		criteria.andNotEqualTo("loginName", loginName);
		int result = uacUserService.selectCountByExample(example);
		if (result > 0) {
			throw new UacBizException(ErrorCodeEnum.UAC10011019);
		}

		String emailCode = RandomUtil.createNumberCode(6);
		String key = RedisKeyUtil.getSendEmailCodeKey(loginName, email);
		// 在redis中绑定验证码
		redisService.setKey(key, emailCode, 7 * 24, TimeUnit.HOURS);

		// 先写死 类型多了再抽方法
		Map<String, Object> param = Maps.newHashMap();
		param.put("loginName", loginName);
		param.put("email", email);
		param.put("emailCode", emailCode);
		param.put("dateTime", DateUtil.formatDateTime(new Date()));

		Set<String> to = Sets.newHashSet();
		to.add(email);

		MqMessageData mqMessageData = emailProducer.sendEmailMq(to, UacEmailTemplateEnum.RESET_USER_EMAIL, AliyunMqTopicConstants.MqTagEnum.RESET_LOGIN_PWD, param);

View on GitHub (pinned to 781281a950)