Making uid more compatible
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-10-28 06:06:17 +01:00
parent 9674807093
commit 25f2bd2ae4
2 changed files with 2 additions and 0 deletions

View File

@ -38,6 +38,7 @@ V1.post("/db/:database/query", async (ctx) => {
if (authkey && db.publickey) { if (authkey && db.publickey) {
let res = await verifyJWT(authkey, db.publickey); let res = await verifyJWT(authkey, db.publickey);
if (res && !res.uid && res.user) res.uid = res.user;
if (!res || !res.uid) { if (!res || !res.uid) {
throw new BadRequestError("Invalid JWT"); throw new BadRequestError("Invalid JWT");
} else { } else {

View File

@ -55,6 +55,7 @@ export class WebsocketConnectionManager {
const authkey = query.get("authkey"); const authkey = query.get("authkey");
if (authkey && db.publickey) { if (authkey && db.publickey) {
let res = await verifyJWT(authkey, db.publickey); let res = await verifyJWT(authkey, db.publickey);
if (res && !res.uid && res.user) res.uid = res.user;
if (!res || !res.uid) { if (!res || !res.uid) {
sendError("Invalid JWT"); sendError("Invalid JWT");
socket.close(); socket.close();