fix(notify): add verification flow for saved unverified emails
- Add "verify" button next to saved unverified emails in ProfileBalanceNotifyCard (send code → enter code → verify) - Backend: VerifyAndAddNotifyEmail now marks existing unverified emails as verified instead of returning "already exists" - Inline verification UI with countdown timer and resend button
This commit is contained in:
@@ -336,14 +336,18 @@ func (s *UserService) VerifyAndAddNotifyEmail(ctx context.Context, userID int64,
|
||||
return err
|
||||
}
|
||||
|
||||
// Check if already exists
|
||||
for _, e := range user.BalanceNotifyExtraEmails {
|
||||
// Check if already exists — if unverified, mark as verified
|
||||
for i, e := range user.BalanceNotifyExtraEmails {
|
||||
if strings.EqualFold(e.Email, email) {
|
||||
return nil // Already added
|
||||
if !e.Verified {
|
||||
user.BalanceNotifyExtraEmails[i].Verified = true
|
||||
return s.userRepo.Update(ctx, user)
|
||||
}
|
||||
return nil // Already verified
|
||||
}
|
||||
}
|
||||
|
||||
// Check limit (total includes primary email="" placeholder + extra emails)
|
||||
// Check limit
|
||||
if len(user.BalanceNotifyExtraEmails) >= maxNotifyEmails {
|
||||
return infraerrors.BadRequest("TOO_MANY_NOTIFY_EMAILS", fmt.Sprintf("maximum %d notification emails allowed", maxNotifyEmails))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user