logging
This commit is contained in:
@@ -19,6 +19,9 @@ export class ActivityLog {
|
|||||||
@Column({ default: 0, type: 'int' })
|
@Column({ default: 0, type: 'int' })
|
||||||
loginCounter: number;
|
loginCounter: number;
|
||||||
|
|
||||||
|
@Column({ default: 0, type: 'int' })
|
||||||
|
applicationLogin: number;
|
||||||
|
|
||||||
@Column({ default: 0, type: 'int' })
|
@Column({ default: 0, type: 'int' })
|
||||||
accessTokensVerifies: number;
|
accessTokensVerifies: number;
|
||||||
|
|
||||||
@@ -38,7 +41,14 @@ export class ActivityLogRepository extends Repository<ActivityLog> {
|
|||||||
return this.save(entity);
|
return this.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async logApplicationLogin(): Promise<ActivityLog> {
|
||||||
|
const entity = await this.getTodaysActivityLog();
|
||||||
|
entity.applicationLogin += 1;
|
||||||
|
return this.save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
async logLogin(): Promise<ActivityLog> {
|
async logLogin(): Promise<ActivityLog> {
|
||||||
|
console.log("LOGIN")
|
||||||
const entity = await this.getTodaysActivityLog();
|
const entity = await this.getTodaysActivityLog();
|
||||||
entity.loginCounter += 1;
|
entity.loginCounter += 1;
|
||||||
return this.save(entity);
|
return this.save(entity);
|
||||||
|
|||||||
@@ -273,6 +273,7 @@ export class UsersService {
|
|||||||
});
|
});
|
||||||
const session = await this.sessionRepo.save(s);
|
const session = await this.sessionRepo.save(s);
|
||||||
user.session_key = session.id;
|
user.session_key = session.id;
|
||||||
|
this.activityRepo.logApplicationLogin();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { User } from '../model/user.interface';
|
import { User } from '../model/user.interface';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService {
|
||||||
|
private router: Router = inject(Router);
|
||||||
|
|
||||||
private _user: User;
|
private _user: User;
|
||||||
|
|
||||||
@@ -18,4 +20,11 @@ export class UserService {
|
|||||||
get user(): User {
|
get user(): User {
|
||||||
return this._user;
|
return this._user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
this.user = null;
|
||||||
|
localStorage.clear();
|
||||||
|
this.router.navigateByUrl('/');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="title">SSO Beantastic</div>
|
<div class="title">SSO Beantastic</div>
|
||||||
<div> {{ userName }} </div>
|
<div class="flex-row">
|
||||||
|
<div> {{ userName }}</div>
|
||||||
|
<div class="logout" (click)="logout()" ></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-row body_design">
|
<div class="flex-row body_design">
|
||||||
|
|||||||
@@ -61,3 +61,19 @@
|
|||||||
gap: 32px;
|
gap: 32px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout{
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: transparent;
|
||||||
|
background-position: center;
|
||||||
|
background-size: 20px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -117,6 +117,9 @@ export class DashboardComponent implements OnInit {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
this.userService.logout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
45
idp_client/src/assets/icons/logout.svg
Normal file
45
idp_client/src/assets/icons/logout.svg
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
|
viewBox="0 0 471.2 471.2" style="enable-background:new 0 0 471.2 471.2;" xml:space="preserve">
|
||||||
|
<g>
|
||||||
|
<g>
|
||||||
|
<path d="M227.619,444.2h-122.9c-33.4,0-60.5-27.2-60.5-60.5V87.5c0-33.4,27.2-60.5,60.5-60.5h124.9c7.5,0,13.5-6,13.5-13.5
|
||||||
|
s-6-13.5-13.5-13.5h-124.9c-48.3,0-87.5,39.3-87.5,87.5v296.2c0,48.3,39.3,87.5,87.5,87.5h122.9c7.5,0,13.5-6,13.5-13.5
|
||||||
|
S235.019,444.2,227.619,444.2z"/>
|
||||||
|
<path d="M450.019,226.1l-85.8-85.8c-5.3-5.3-13.8-5.3-19.1,0c-5.3,5.3-5.3,13.8,0,19.1l62.8,62.8h-273.9c-7.5,0-13.5,6-13.5,13.5
|
||||||
|
s6,13.5,13.5,13.5h273.9l-62.8,62.8c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4l85.8-85.8
|
||||||
|
C455.319,239.9,455.319,231.3,450.019,226.1z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -16,6 +16,10 @@ html, body {
|
|||||||
background-image: url("assets/icons/user.svg");
|
background-image: url("assets/icons/user.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logout {
|
||||||
|
background-image: url("assets/icons/logout.svg");
|
||||||
|
}
|
||||||
|
|
||||||
.flex-row{
|
.flex-row{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
Reference in New Issue
Block a user