mirror of
https://github.com/hknsh/project-knedita.git
synced 2024-11-28 17:41:15 +00:00
Updated cookie name
This commit is contained in:
parent
af1cc94d8e
commit
81b0c05d68
3 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ async function userAuthController(req: Request, res: Response): Promise<void> {
|
||||||
badRequest(res, result.message)
|
badRequest(res, result.message)
|
||||||
} else {
|
} else {
|
||||||
res
|
res
|
||||||
.cookie('token', result.token, {
|
.cookie('knedita_token', result.token, {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: process.env.NODE_ENV === 'production',
|
secure: process.env.NODE_ENV === 'production',
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@ async function userLogoutController(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// @ts-expect-error clearCookie interface does not exists in Response.
|
// @ts-expect-error clearCookie interface does not exists in Response.
|
||||||
return res
|
return res
|
||||||
.clearCookie('token')
|
.clearCookie('knedita_token')
|
||||||
.status(200)
|
.status(200)
|
||||||
.json({ message: 'Successfully logged out' })
|
.json({ message: 'Successfully logged out' })
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ async function authenticated(
|
||||||
next: NextFunction,
|
next: NextFunction,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const token = req.cookies.token
|
const token = req.cookies.knedita_token
|
||||||
|
|
||||||
if (token === undefined) {
|
if (token === undefined) {
|
||||||
unauthorized(res, 'Missing token')
|
unauthorized(res, 'Missing token')
|
||||||
|
|
Loading…
Reference in a new issue