🧹 cleanups

This commit is contained in:
Philipp Dormann 2020-12-05 17:25:57 +01:00
parent 7e4ce00c30
commit e5b605cc55
6 changed files with 5 additions and 11 deletions

View File

@ -5,8 +5,8 @@ import { UserNotFoundError } from '../errors/UserErrors';
import { CreateAuth } from '../models/creation/CreateAuth';
import { HandleLogout } from '../models/creation/HandleLogout';
import { RefreshAuth } from '../models/creation/RefreshAuth';
import { Auth } from '../models/entities/Auth';
import { Logout } from '../models/entities/Logout';
import { Auth } from '../models/responses/Auth';
import { Logout } from '../models/responses/Logout';
@JsonController('/auth')
export class AuthController {

View File

@ -4,8 +4,8 @@ import * as jsonwebtoken from 'jsonwebtoken';
import { getConnectionManager } from 'typeorm';
import { InvalidCredentialsError, PasswordNeededError, UserNotFoundError } from '../../errors/AuthError';
import { UsernameOrEmailNeededError } from '../../errors/UserErrors';
import { Auth } from '../entities/Auth';
import { User } from '../entities/User';
import { Auth } from '../responses/Auth';
export class CreateAuth {
@IsOptional()

View File

@ -2,8 +2,8 @@ import { IsString } from 'class-validator';
import * as jsonwebtoken from 'jsonwebtoken';
import { getConnectionManager } from 'typeorm';
import { IllegalJWTError, JwtNotProvidedError, RefreshTokenCountInvalidError, UserNotFoundError } from '../../errors/AuthError';
import { Logout } from '../entities/Logout';
import { User } from '../entities/User';
import { Logout } from '../responses/Logout';
export class HandleLogout {
@IsString()
@ -20,7 +20,6 @@ export class HandleLogout {
} catch (error) {
throw new IllegalJWTError()
}
logout.access_token = this.token
logout.timestamp = Math.floor(Date.now() / 1000)
let found_user: User = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] });
if (!found_user) {

View File

@ -2,8 +2,8 @@ import { IsString } from 'class-validator';
import * as jsonwebtoken from 'jsonwebtoken';
import { getConnectionManager } from 'typeorm';
import { IllegalJWTError, JwtNotProvidedError, RefreshTokenCountInvalidError, UserNotFoundError } from '../../errors/AuthError';
import { Auth } from '../entities/Auth';
import { User } from '../entities/User';
import { Auth } from '../responses/Auth';
export class RefreshAuth {
@IsString()

View File

@ -4,11 +4,6 @@ import { IsString } from 'class-validator';
* Defines a Logout object
*/
export class Logout {
/**
* access_token - JWT shortterm access token
*/
@IsString()
access_token: string;
/**
* timestamp of logout
*/