Login end-to-end en Next.js: iron-session + auth SRP6 + página i18n
- lib/session.ts: sesión cifrada httpOnly con iron-session (SESSION_SECRET en
.env.local). SessionData {bnetId, bnetEmail, username, accountId}.
- lib/auth.ts: authenticate(email,password) verifica contra battlenet_accounts con
bnetVerify (SRP6 v2); getGameAccounts(bnetId). Resiliente si acore no está.
- app/api/auth/login/route.ts: POST -> autentica, fija sesión, resuelve cuentas de
juego (1 -> auto; 0/varias -> needsSelection). Devuelve JSON.
- app/[locale]/login: página SSR + LoginForm (cliente, next-intl, router i18n).
Textos en messages/*.json (namespace Login).
- tsconfig target ES2020 (literales BigInt de bnet.ts).
Validado end-to-end: con una cuenta creada por bnet.py (como haría AzerothCore),
el login TS la verifica OK y emite la cookie de sesión; password incorrecta ->
invalidCredentials; sin campos -> missingFields. Página en ES y EN.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,5 +15,20 @@
|
||||
"noNews": "There are no news available at the moment.",
|
||||
"link": "Link",
|
||||
"here": "here"
|
||||
},
|
||||
"Login": {
|
||||
"title": "Sign in to Nova WoW",
|
||||
"email": "Email",
|
||||
"password": "Password",
|
||||
"submit": "Sign in",
|
||||
"connecting": "Signing in…",
|
||||
"success": "Signed in successfully. Redirecting…",
|
||||
"invalidCredentials": "Incorrect email or password",
|
||||
"missingFields": "Please fill in all fields.",
|
||||
"invalidRequest": "Invalid request.",
|
||||
"genericError": "Something went wrong. Please try again later.",
|
||||
"forgot": "I forgot my password/username",
|
||||
"newHere": "New to the community? You can create an account",
|
||||
"createAccount": "here"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user