First part of the action comment refactoring
ref #39 Why did i volunteer for this? It's just a glorified sleeping aid 😴
This commit is contained in:
@@ -6,11 +6,23 @@ import { IllegalJWTError, JwtNotProvidedError, RefreshTokenCountInvalidError, Us
|
||||
import { User } from '../entities/User';
|
||||
import { Logout } from '../responses/ResponseLogout';
|
||||
|
||||
/**
|
||||
* This class handels a user logging out of the system.
|
||||
* Of course it check's the user's provided credential (token) before logging him out.
|
||||
*/
|
||||
export class HandleLogout {
|
||||
/**
|
||||
* A stringyfied jwt access token.
|
||||
* Will get checked for validity.
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
token?: string;
|
||||
|
||||
/**
|
||||
* Logs the user out.
|
||||
* This gets achived by increasing the user's refresh token count, thereby invalidateing all currently existing jwts for that user.
|
||||
*/
|
||||
public async logout(): Promise<Logout> {
|
||||
let logout: Logout = new Logout();
|
||||
if (!this.token || this.token === undefined) {
|
||||
|
||||
Reference in New Issue
Block a user