parent
6403e386ab
commit
1d54fb085b
@ -43,7 +43,7 @@ const authchecker = async (action: Action, permissions: string[] | string) => {
|
|||||||
const refresh = async (action: Action) => {
|
const refresh = async (action: Action) => {
|
||||||
let refresh_token = undefined;
|
let refresh_token = undefined;
|
||||||
try {
|
try {
|
||||||
cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
|
refresh_token = cookie.parse(action.request.headers["cookie"])["lfk_backend__refresh_token"];
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
throw new IllegalJWTError();
|
throw new IllegalJWTError();
|
||||||
|
@ -23,11 +23,11 @@ export class HandleLogout {
|
|||||||
throw new IllegalJWTError()
|
throw new IllegalJWTError()
|
||||||
}
|
}
|
||||||
logout.timestamp = Math.floor(Date.now() / 1000)
|
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) {
|
if (!found_user) {
|
||||||
throw new UserNotFoundError()
|
throw new UserNotFoundError()
|
||||||
}
|
}
|
||||||
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
|
if (found_user.refreshTokenCount !== decoded["refreshTokenCount"]) {
|
||||||
throw new RefreshTokenCountInvalidError()
|
throw new RefreshTokenCountInvalidError()
|
||||||
}
|
}
|
||||||
found_user.refreshTokenCount++;
|
found_user.refreshTokenCount++;
|
||||||
|
@ -27,7 +27,7 @@ export class RefreshAuth {
|
|||||||
if (!found_user) {
|
if (!found_user) {
|
||||||
throw new UserNotFoundError()
|
throw new UserNotFoundError()
|
||||||
}
|
}
|
||||||
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
|
if (found_user.refreshTokenCount !== decoded["refreshTokenCount"]) {
|
||||||
throw new RefreshTokenCountInvalidError()
|
throw new RefreshTokenCountInvalidError()
|
||||||
}
|
}
|
||||||
//Create the auth token
|
//Create the auth token
|
||||||
|
Loading…
x
Reference in New Issue
Block a user