Merge pull request #1878 from hedgedoc/bug/session_guard

This commit is contained in:
David Mehren 2021-12-07 22:38:42 +01:00 committed by GitHub
commit abcd8e03f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,7 @@ export class SessionGuard implements CanActivate {
async canActivate(context: ExecutionContext): Promise<boolean> {
const request: Request & { session?: { user: string }; user?: User } =
context.switchToHttp().getRequest();
if (!request.session) {
if (!request.session?.user) {
this.logger.debug('The user has no session.');
throw new UnauthorizedException("You're not logged in");
}