-
Notifications
You must be signed in to change notification settings - Fork 0
done #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
done #38
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -178,6 +178,17 @@ router.post( | |||||
| parallelism: 1 | ||||||
| }); | ||||||
|
|
||||||
| // 4. Cookie発行 | ||||||
| CreateCookie({ | ||||||
| res, | ||||||
| cookieName: 'LOGIN_TOKEN', | ||||||
| payload: { userId, address: address }, | ||||||
| secretKey: process.env.LOGIN_SECRET, | ||||||
| deadlineHours: 24, // 1日有効 | ||||||
|
||||||
| deadlineHours: 24, // 1日有効 | |
| deadlineHours: 24, // JWTは1日有効(Cookie自体はセッション有効) |
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateCookie is used here but Register.js does not import it (there are no other references in this file). This will throw ReferenceError: CreateCookie is not defined at runtime; add the appropriate import (matching how Login.js imports it from ../Tools/CreateCookie.js).
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issues the login cookie before the user record is persisted. If the DB insert fails (or the request errors after cookie issuance), the client can end up holding a valid LOGIN_TOKEN for a userId/address that was never saved. Move cookie issuance to after the DB insert succeeds (and consider clearing any already-set cookie on error paths).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secretKey: process.env.LOGIN_SECRETcan beundefined, which causesjwt.signinsideCreateCookieto throw ("secretOrPrivateKey must have a value"). Consider validatingLOGIN_SECRET(similar to the existingPEPPERcheck) and returning a configuration error before attempting to create the cookie.