Compare commits
2 Commits
91499578c4
...
46dd4ccb91
| Author | SHA1 | Date |
|---|---|---|
|
|
46dd4ccb91 | |
|
|
4d39f39c38 |
|
|
@ -79,6 +79,15 @@ export class AuthController {
|
||||||
this.sendToken(user, res, {long: longExpiration})
|
this.sendToken(user, res, {long: longExpiration})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
public handleLogout = catchAsync(async (req: AppRequest, res, next) => {
|
||||||
|
// Set the jwt cookie to a dummy value and set the expiration to a date in the past
|
||||||
|
res.cookie('jwt', 'loggedout', {
|
||||||
|
expires: new Date(Date.now() - 10000),
|
||||||
|
httpOnly: true
|
||||||
|
})
|
||||||
|
res.status(200).json({status: 'success'})
|
||||||
|
})
|
||||||
|
|
||||||
public protect = catchAsync(async (req: AppRequest, res, next) => {
|
public protect = catchAsync(async (req: AppRequest, res, next) => {
|
||||||
let token: string | undefined;
|
let token: string | undefined;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue