newStaffLDB-API #48
@ -6,7 +6,10 @@ module.exports = async function authCheck(req, res, next) {
|
|||||||
try {
|
try {
|
||||||
var uuid = req.headers.uuid;
|
var uuid = req.headers.uuid;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.out("authMiddlewares: UNABLE TO READ HEADER 'UUID' - User !isAuthed", "warn");
|
log.out(
|
||||||
|
"authMiddlewares: UNABLE TO READ HEADER 'UUID' - User !isAuthed",
|
||||||
|
"warn"
|
||||||
|
);
|
||||||
req.isAuthed = false;
|
req.isAuthed = false;
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
@ -21,7 +24,10 @@ module.exports = async function authCheck(req, res, next) {
|
|||||||
}
|
}
|
||||||
return next();
|
return next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.out("authMiddlewares: Unable to check auth, default to !isAuthed", "warn")
|
log.out(
|
||||||
|
"authMiddlewares: Unable to check auth, default to !isAuthed",
|
||||||
|
"warn"
|
||||||
|
);
|
||||||
req.isAuthed = false;
|
req.isAuthed = false;
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ async function query(collection, query, returnId = false) {
|
|||||||
}
|
}
|
||||||
log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`, "info");
|
log.out(`dbAccess.query: Running Query: ${JSON.stringify(query)}`, "info");
|
||||||
increment(collection);
|
increment(collection);
|
||||||
log.out('dbAccess.query: Query response:')
|
log.out("dbAccess.query: Query response:");
|
||||||
console.log(await qcursor.toArray())
|
console.log(await qcursor.toArray());
|
||||||
return await qcursor.toArray();
|
return await qcursor.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ async function arrDepBoardStaff(CRS) {
|
|||||||
const _staffLdb = staffStationTransform(result);
|
const _staffLdb = staffStationTransform(result);
|
||||||
console.log("Transformation Test Successful");
|
console.log("Transformation Test Successful");
|
||||||
console.log(JSON.stringify(_staffLdb));
|
console.log(JSON.stringify(_staffLdb));
|
||||||
return _staffLdb
|
return _staffLdb;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("Transformation Test Failed: " + err);
|
console.log("Transformation Test Failed: " + err);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,9 @@ import { minifyMail } from "./minify.utils";
|
|||||||
// Checks users registration key against issued keys
|
// Checks users registration key against issued keys
|
||||||
async function isAuthed(uuid: string): Promise<boolean> {
|
async function isAuthed(uuid: string): Promise<boolean> {
|
||||||
// Needs testing
|
// Needs testing
|
||||||
const q = { /*uuid: uuid*/ };
|
const q = {
|
||||||
|
/*uuid: uuid*/
|
||||||
|
};
|
||||||
const res = await db.query("users", q);
|
const res = await db.query("users", q);
|
||||||
logs.out(
|
logs.out(
|
||||||
"authUtils.checkUser: DB Query answer: " + JSON.stringify(res[0]),
|
"authUtils.checkUser: DB Query answer: " + JSON.stringify(res[0]),
|
||||||
|
Loading…
Reference in New Issue
Block a user