feat: add email verification code for registration and optimize email service
- Add POST /user/email/code endpoint to send 6-digit verification code - Require email code verification before completing registration - Add email code cache with 10min TTL and 5/day send rate limit - Fix nil client guard, TLS conn leak, domain parsing, and Resend error body in email pkg - Deploy via ssh inline command using current branch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,8 @@ const (
|
||||
CodeEmailExists = 1004
|
||||
CodeEmailNotFound = 1005
|
||||
CodePasswordMismatch = 1006
|
||||
CodeEmailCodeError = 1007
|
||||
CodeEmailSendLimit = 1008
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -36,6 +38,8 @@ const (
|
||||
CodeEmailExistsMsg = "email already registered"
|
||||
CodeEmailNotFoundMsg = "email not found"
|
||||
CodePasswordMismatchMsg = "password mismatch"
|
||||
CodeEmailCodeErrorMsg = "email code error"
|
||||
CodeEmailSendLimitMsg = "email send limit reached"
|
||||
)
|
||||
|
||||
type BusinessError struct {
|
||||
@@ -61,4 +65,6 @@ var (
|
||||
ErrEmailExists = NewError(CodeEmailExists, CodeEmailExistsMsg, nil)
|
||||
ErrEmailNotFound = NewError(CodeEmailNotFound, CodeEmailNotFoundMsg, nil)
|
||||
ErrPasswordMismatch = NewError(CodePasswordMismatch, CodePasswordMismatchMsg, nil)
|
||||
ErrEmailCodeError = NewError(CodeEmailCodeError, CodeEmailCodeErrorMsg, nil)
|
||||
ErrEmailSendLimit = NewError(CodeEmailSendLimit, CodeEmailSendLimitMsg, nil)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user