Cambio de email con doble confirmación (completa el bloque de auth)

- lib/change-email.ts: requestEmailChange (valida pass/email/token, crea activación
  con old_email/old_email_hash, email al correo actual), confirmOldEmail (marca is_used,
  email al nuevo), confirmNewEmail (re-deriva verifier con el nuevo email + actualiza
  battlenet_accounts y account; borra la activación).
- components/ConfirmClient.tsx: cliente genérico que confirma un hash por POST al abrir.
- Routes /api/account/change-email, /confirm-old-email, /confirm-new-email.
- Páginas /change-email (protegida) y /confirm-old-email, /confirm-new-email (auto).
- Catálogos ChangeEmail, ConfirmOldEmail, ConfirmNewEmail.

Verificado: change-email protegida (401/redirect), confirmaciones con hash inválido
-> invalidLink sin crash. AUTH 100% reimplementado en Next.js.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 23:41:42 +00:00
parent 1da7349373
commit cceab26999
11 changed files with 390 additions and 0 deletions
+31
View File
@@ -206,5 +206,36 @@
"wrongCurrentPassword": "The current password is incorrect.",
"accountNotFound": "Account not found.",
"genericError": "Something went wrong. Please try again later."
},
"ChangeEmail": {
"title": "Change email",
"info": "The current email must be entered exactly, respecting case. The new email must be a Gmail address. You need a security token.",
"currentPassword": "Current password",
"currentEmail": "Current email",
"newEmail": "New email",
"confEmail": "Confirm new email",
"token": "Security token",
"submit": "Change email",
"sending": "Sending…",
"success": "A confirmation email has been sent to your current email.",
"missingFields": "Please fill in all fields.",
"wrongCurrentEmail": "The current email is not correct.",
"invalidEmail": "The new email is not valid.",
"invalidToken": "The security token is incorrect.",
"wrongCurrentPassword": "The current password is incorrect.",
"genericError": "Something went wrong. Please try again later."
},
"ConfirmOldEmail": {
"title": "Confirm email change",
"activating": "Confirming…",
"success": "Current email confirmed. Check your NEW email to complete the second step.",
"error": "The link is invalid or has already been used."
},
"ConfirmNewEmail": {
"title": "Confirm new email",
"activating": "Applying the change…",
"success": "Email changed successfully! You can now sign in with the new email.",
"error": "The link is invalid, expired or the account was not found.",
"goLogin": "Go to sign in"
}
}