mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-30 01:49:13 -05:00
Merge pull request #1878 from hedgedoc/bug/session_guard
This commit is contained in:
commit
abcd8e03f9
1 changed files with 1 additions and 1 deletions
|
@ -27,7 +27,7 @@ export class SessionGuard implements CanActivate {
|
||||||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||||
const request: Request & { session?: { user: string }; user?: User } =
|
const request: Request & { session?: { user: string }; user?: User } =
|
||||||
context.switchToHttp().getRequest();
|
context.switchToHttp().getRequest();
|
||||||
if (!request.session) {
|
if (!request.session?.user) {
|
||||||
this.logger.debug('The user has no session.');
|
this.logger.debug('The user has no session.');
|
||||||
throw new UnauthorizedException("You're not logged in");
|
throw new UnauthorizedException("You're not logged in");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue