{"record":{"id":"d9d9b7201f1c09f1","repo":"paascloud/paascloud-master","slug":"uac10011019-d9d9b7","errorCode":"UAC10011019","errorMessage":"邮箱已存在","messagePattern":"邮箱已存在","errorType":"error_code","errorClass":"UacBizException","httpStatus":null,"severity":"warning","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java","lineNumber":974,"sourceCode":"\t\tUacUser uacUser = new UacUser();\n\t\tuacUser.setLoginName(registerDto.getLoginName());\n\t\tint count = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011012);\n\t\t}\n\n\t\tuacUser = new UacUser();\n\t\tuacUser.setMobileNo(registerDto.getMobileNo());\n\t\tcount = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011013);\n\t\t}\n\n\t\tuacUser = new UacUser();\n\t\tuacUser.setEmail(registerDto.getEmail());\n\t\tcount = uacUserMapper.selectCount(uacUser);\n\t\tif (count > 0) {\n\t\t\tthrow new UacBizException(ErrorCodeEnum.UAC10011019);\n\t\t}\n\n\t}\n}\n","sourceCodeStart":956,"sourceCodeEnd":979,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacUserServiceImpl.java#L956-L979","documentation":"UAC10011019 is thrown during registration when a UacUser template with the requested email yields selectCount > 0, meaning an account with that email already exists. Registration is rejected with '邮箱已存在' to keep emails unique (the email is also the activation/reset identity, see UAC10011004).","triggerScenarios":"Registering with an email already used by another account; retrying after a previous registration already created the row; email case differences (Foo@x.com vs foo@x.com) counting as the same user on case-insensitive collations; concurrent duplicate submissions (double-click on Register).","commonSituations":"Users forgetting they registered and hitting 'sign up' again; double-submit from an unthrottled form button; corporate shared mailboxes; migration leaving both legacy and new rows with the same email.","solutions":["If the account exists, use login or 'forgot password' instead of registering again.","Check email availability before submitting (validation endpoint or SELECT COUNT(*) FROM uac_user WHERE email = ?).","Normalize/trim/lowercase the email on both insert and lookup to avoid case-variant duplicates.","Debounce/disable the submit button server-side (idempotency key) to prevent double-registration races, and add a UNIQUE index on email."],"exampleFix":"// before\nUacUser q = new UacUser(); q.setEmail(registerDto.getEmail());\nif (uacUserMapper.selectCount(q) > 0) { throw new UacBizException(ErrorCodeEnum.UAC10011019); }\n// after\nString email = registerDto.getEmail().trim().toLowerCase();\nUacUser q = new UacUser(); q.setEmail(email);\nif (uacUserMapper.selectCount(q) > 0) { throw new UacBizException(ErrorCodeEnum.UAC10011019); }\nregisterDto.setEmail(email);","handlingStrategy":"validation","validationCode":"UacUser q = new UacUser();\nq.setEmail(requestedEmail.trim().toLowerCase());\nif (uacUserMapper.selectCount(q) > 0) {\n    return Result.fail(\"email already registered; please log in or reset password\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    uacUserService.register(registerDto);\n} catch (UacBizException e) {\n    if (\"UAC10011019\".equals(e.getCode())) { return Result.fail(409, \"email already exists\"); }\n    throw e;\n}","preventionTips":["Normalize email case/trim on insert and lookup.","Debounce the register button / use idempotency keys to stop double submissions.","Offer a clear 'already have an account? log in' path on the register screen.","Add a UNIQUE index on email in the database."],"tags":["registration","duplicate","email","validation"],"backgroundTag":"record-already-exists","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"}