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