Shoothed out variable nameing scheme

ref #6
This commit is contained in:
Nicolai Ort 2020-12-18 19:19:47 +01:00
parent 6403e386ab
commit 1d54fb085b
3 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
const refresh = async (action: Action) => {
let refresh_token = undefined;
try {
cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
refresh_token = cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
}
catch {
throw new IllegalJWTError();

View File

@ -23,11 +23,11 @@ export class HandleLogout {
throw new IllegalJWTError()
}
logout.timestamp = Math.floor(Date.now() / 1000)
let found_user: User = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] });
let found_user: User = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["id"] });
if (!found_user) {
throw new UserNotFoundError()
}
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
if (found_user.refreshTokenCount !== decoded["refreshTokenCount"]) {
throw new RefreshTokenCountInvalidError()
}
found_user.refreshTokenCount++;

View File

@ -27,7 +27,7 @@ export class RefreshAuth {
if (!found_user) {
throw new UserNotFoundError()
}
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
if (found_user.refreshTokenCount !== decoded["refreshTokenCount"]) {
throw new RefreshTokenCountInvalidError()
}
//Create the auth token