login
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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"];
|
||||
|
||||
Reference in New Issue
Block a user