feature/refactor-login #19
|
@ -1 +1,2 @@
|
|||
export * from './local.auth.guard';
|
||||
export * from './is-authenticated.guard';
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
||||
|
||||
export class IsAuthenticatedGuard implements CanActivate {
|
||||
public canActivate(context: ExecutionContext): boolean {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
|
||||
return request.isAuthenticated();
|
||||
}
|
||||
}
|
|
@ -12,12 +12,13 @@ export class SigninResponseDto {
|
|||
@IsEmail()
|
||||
public email: string;
|
||||
|
||||
@ApiProperty({
|
||||
title: 'User ID',
|
||||
description: 'User ID',
|
||||
})
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@IsEmail()
|
||||
public id: string;
|
||||
// TODO: ID is saved in the session, so it is not needed here
|
||||
// @ApiProperty({
|
||||
// title: 'User ID',
|
||||
// description: 'User ID',
|
||||
// })
|
||||
// @IsNotEmpty()
|
||||
// @IsString()
|
||||
// @IsEmail()
|
||||
// public id: string;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ export class AuthService {
|
|||
existingUser.id
|
||||
);
|
||||
|
||||
// TODO: Add OTP or 2FA here as an additional security measure
|
||||
await this.passwordConfirmationMailService.sendLoginLinkEmail(
|
||||
magiclink.email,
|
||||
token
|
||||
|
@ -202,8 +203,8 @@ export class AuthService {
|
|||
public getLoginResponse(
|
||||
user: SigninResponseDto & { userAgent: string }
|
||||
): SigninResponseDto {
|
||||
const { id, email }: SigninResponseDto = user;
|
||||
const responseData: SigninResponseDto = { id, email };
|
||||
const { email }: SigninResponseDto = user;
|
||||
const responseData: SigninResponseDto = { email };
|
||||
|
||||
return responseData;
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
? 'compact'
|
||||
: 'closed'
|
||||
"
|
||||
class="h-full overflow-hidden transition-transform duration-300 ease-in-out bg-primary text-primary-content flex flex-col lg:translate-x-0"
|
||||
class="h-full transition-transform duration-300 ease-in-out bg-primary text-primary-content flex flex-col lg:translate-x-0"
|
||||
[ngClass]="{
|
||||
'w-16': isCompact && !isDrawerOpen,
|
||||
'w-64': isDrawerOpen,
|
||||
|
@ -383,13 +383,15 @@
|
|||
(keydown.space)="toggleDrawer()"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<div class="flex-1 overflow-y-auto bg-base-100">
|
||||
<main [ngStyle]="mainContent" class="flex-1 w-full h-full">
|
||||
<div class="w-full h-full flex">
|
||||
<div class="w-full">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex-1 overflow-y-auto bg-base-100 transition-all duration-200 ease-in-out"
|
||||
[ngClass]="{
|
||||
'ml-16 lg:ml-0': isCompact && isMobile,
|
||||
'ml-64 lg:ml-0': !isCompact && isDrawerOpen && isMobile,
|
||||
'ml-0': (!isDrawerOpen && !isCompact) || !isMobile
|
||||
}">
|
||||
<main [ngStyle]="mainContent" class="w-full h-full p-4">
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue