From 512160799e4d7be43528a0ab464c312e1ee9bb86 Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Sun, 8 Sep 2024 13:57:58 +0200 Subject: [PATCH] canvas --- idp/.env.skeleton | 4 +- idp/src/application/user/user.service.ts | 3 +- idp/src/auth/auth.controller.ts | 5 +- idp/src/core/custom.logger.ts | 9 ++- .../charts/login/login.component.html | 3 +- .../charts/login/login.component.scss | 3 + .../app/dashboard/dashboard.component.html | 55 +++++++++---------- .../app/dashboard/dashboard.component.scss | 7 +++ 8 files changed, 55 insertions(+), 34 deletions(-) diff --git a/idp/.env.skeleton b/idp/.env.skeleton index bd6c2c4..8b66b1d 100644 --- a/idp/.env.skeleton +++ b/idp/.env.skeleton @@ -7,7 +7,6 @@ DATABASE_PORT=3306 MYSQL_ROOT_PASSWORD=kjsdahflöijsdiu # security -IGNORE_PASSWORDS=FALSE # hier kann man sich nur mit dem Username einloggen, nicht zu empfehlen ausser zum debuggen JWT_SECRET=super-geheimes-secret JWT_EXPIRES_IN=10m JWT_REFRESH_EXPIRES_IN=1w @@ -24,4 +23,5 @@ MAILER_PASSWORD=xxxxx MAILER_FROM='"No Reply" ' # Client -CLIENT_URL=http://localhost:4200 \ No newline at end of file +CLIENT_URL=http://localhost:4200 +PRODUCTION=true \ No newline at end of file diff --git a/idp/src/application/user/user.service.ts b/idp/src/application/user/user.service.ts index 2452913..f2fe25b 100644 --- a/idp/src/application/user/user.service.ts +++ b/idp/src/application/user/user.service.ts @@ -8,7 +8,8 @@ export class UserService { constructor( private clientRepository: ClientRepository, private logRepository: LogRepository, - ) {} + ) { + } getUserClients(user: User): Promise { return this.clientRepository.find({ diff --git a/idp/src/auth/auth.controller.ts b/idp/src/auth/auth.controller.ts index 94500db..8f58252 100644 --- a/idp/src/auth/auth.controller.ts +++ b/idp/src/auth/auth.controller.ts @@ -31,7 +31,10 @@ export class AuthController { password, clientId, ); - this.logger.log(`User ${username} logged in on client ${clientId}`); + this.logger.log( + `User ${username} logged in on client ${clientId}`, + clientId != null ? 'login' : 'systemlogin', + ); return token; } diff --git a/idp/src/core/custom.logger.ts b/idp/src/core/custom.logger.ts index bbdd65b..99b21e9 100644 --- a/idp/src/core/custom.logger.ts +++ b/idp/src/core/custom.logger.ts @@ -1,4 +1,5 @@ import { LoggerService, Injectable, Logger } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; import { InjectRepository } from '@nestjs/typeorm'; import { Log, LOGMESSAGETYPE } from 'src/model/log.entity'; import { Repository } from 'typeorm'; @@ -8,13 +9,19 @@ export class CustomLogger implements LoggerService { private readonly logger = new Logger('CustomLogger'); // constructor(private readonly connection: Connection) {} - constructor(@InjectRepository(Log) private logRepository: Repository) {} + constructor( + @InjectRepository(Log) private logRepository: Repository, + private config: ConfigService, + ) {} private async logToDatabase( level: string, message: string, type: LOGMESSAGETYPE = 'system', ) { + if (this.config.get('PRODUCTION') == 'false') { + return; + } const logEntry = new Log(); logEntry.level = level; logEntry.message = message; diff --git a/idp_client/src/app/dashboard/components/charts/login/login.component.html b/idp_client/src/app/dashboard/components/charts/login/login.component.html index 81e8d1c..717116c 100644 --- a/idp_client/src/app/dashboard/components/charts/login/login.component.html +++ b/idp_client/src/app/dashboard/components/charts/login/login.component.html @@ -1,3 +1,4 @@
- {{chart}} +

Logins

+ {{chart}}
\ No newline at end of file diff --git a/idp_client/src/app/dashboard/components/charts/login/login.component.scss b/idp_client/src/app/dashboard/components/charts/login/login.component.scss index e69de29..6f464dd 100644 --- a/idp_client/src/app/dashboard/components/charts/login/login.component.scss +++ b/idp_client/src/app/dashboard/components/charts/login/login.component.scss @@ -0,0 +1,3 @@ +h2 { + margin-top: 0; +} \ No newline at end of file diff --git a/idp_client/src/app/dashboard/dashboard.component.html b/idp_client/src/app/dashboard/dashboard.component.html index 52572ba..a1c3e47 100644 --- a/idp_client/src/app/dashboard/dashboard.component.html +++ b/idp_client/src/app/dashboard/dashboard.component.html @@ -3,32 +3,31 @@
{{ userName }}
-
-
- +
+
+
+
+ + + +
+
+
{{ clients.length }} von 10
+
Clients erstellt
+
+
+ + +
+
+ +
+
+
- -
-
-
{{ clients.length }} von 10
-
Clients erstellt
-
-
- - -
-
- - - - -
-
- - \ No newline at end of file + +
\ No newline at end of file diff --git a/idp_client/src/app/dashboard/dashboard.component.scss b/idp_client/src/app/dashboard/dashboard.component.scss index f701720..5e397f1 100644 --- a/idp_client/src/app/dashboard/dashboard.component.scss +++ b/idp_client/src/app/dashboard/dashboard.component.scss @@ -53,4 +53,11 @@ .title { font-size: 1.5rem; } +} + +.body_design{ + flex-wrap: wrap; + align-items: flex-start; + gap: 32px; + justify-content: center; } \ No newline at end of file