POST /auth/register/email-code

使用邮箱验证码完成无密码注册并自动登录,创建密码豁免用户。注册前需先调用发送验证码接口获取验证码。参考:OWASP ASVS V2.2。

身份认证 None application/json

请求体

Schema: service-identity/internal/handler/dto.RegisterByEmailCodeRequest

字段类型必填示例约束描述
code string 是
email string 是
password string 是 length: 8–256
password_transmission string 否
tenant_id string 否
username string 否 length: 3–32

响应

状态描述Schema
200注册成功并自动登录,返回JWT令牌service-identity/internal/handler/dto.LoginByCodeResponse
400请求参数无效或验证码错误service-core/base/dto.SimpleResponse
500服务器内部错误service-core/base/dto.SimpleResponse

引用的 Schema

service-core/base/dto.SimpleResponse

字段类型必填示例约束描述
code integer 否
message string 否
timestamp string 否

service-identity/internal/handler/dto.LoginByCodeResponse

字段类型必填示例约束描述
access_token string 否
expires_in integer 否
is_new_user boolean 否
membership_status string 否 pending MembershipStatus 新注册待审批(WS-A A3);pending 时不返回 token。
refresh_token string 否
token_type string 否
user service-identity/internal/handler/dto.UserInfo 否
user_id string 否 User ID (redundant with User.ID for flat access)

service-identity/internal/handler/dto.UserInfo

用户基本信息

字段类型必填示例约束描述
created_at string 否 2026-01-15T10:30:00Z Account creation time
email string 否 john@example.com Email
id string 否 usr_abc123 User ID
last_login_at string 否 2026-07-20T08:00:00Z Last login time
metadata object 否 AUTH-44:metadata 仅 /auth/me 回传(portal 偏好等);其余构造点省略。
mfa_enabled boolean 否 True AUTH-44:指针 + omitempty —— 仅权威构造点(/auth/me)填充;其余构造点省略该键, 避免登录响应等处误报 mfa_enabled=false(零值不等于"未启用")。
must_change_password boolean 否 False Password must be changed
password_expires_in integer 否 30 Days until password expires
password_warning string 否 expiring Password warning: expiring/expired_grace/expired
phone string 否 13800138000 Phone
status string 否 active Status
username string 否 john.doe Username