-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update nextjs project to have more realistic controls (#1151)
- Loading branch information
1 parent
bc7f704
commit 721a3d5
Showing
24 changed files
with
530 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
.next/ | ||
.yalc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { serialize } from 'cookie' | ||
import type { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
export default function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const sessionData = req.body | ||
const encryptedSessionData = JSON.stringify(sessionData) | ||
|
||
const cookie = serialize('session', encryptedSessionData, { | ||
httpOnly: false, | ||
secure: false, | ||
maxAge: 60 * 60 * 24 * 7, // One week | ||
path: '/', | ||
}) | ||
res.setHeader('Set-Cookie', cookie) | ||
res.status(200).json({ message: 'Successfully set cookie!' }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { serialize } from 'cookie' | ||
import type { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
export default function handler(req: NextApiRequest, res: NextApiResponse) { | ||
const cookie = serialize('session', '', { | ||
httpOnly: false, | ||
secure: false, | ||
maxAge: 1, // One week | ||
path: '/', | ||
}) | ||
res.setHeader('Set-Cookie', cookie) | ||
res.status(200).json({ message: 'Successfully cleared cookie!' }) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.