This commit is contained in:
Bastian Wagner
2024-08-25 20:48:14 +02:00
parent 5e53dace53
commit 775539f687
2 changed files with 11 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import {
ManyToOne,
DataSource,
Repository,
CreateDateColumn,
} from 'typeorm';
import { User } from './user.entity';
import { Injectable } from '@nestjs/common';
@@ -15,6 +16,9 @@ export class SessionKey {
@ManyToOne(() => User, (user) => user.sessionKeys, { eager: true })
user: User;
@CreateDateColumn()
createdAt: Date;
}
@Injectable()

View File

@@ -37,11 +37,16 @@ export class LoginComponent {
const id = window.localStorage.getItem("auth_sesion_key");
if (!id ||id.length < 2) { return; }
this.toast.loading('Logging in...');
this.http.post(environment.api_url + 'auth/login-with-session-id', {
code: id,
client_id: this.client_id
}).subscribe({
}).pipe(
this.toast.observe({
loading: 'Logging in...',
success: 'Logged in',
error: 'Invalid session, please log in with your credentials'
})
).subscribe({
next: (data) => {
if (data["code"] != null) {
location.href = this.redirectUri + "?code=" + data["code"];