fixed? an issue with client auth
This commit is contained in:
@@ -40,13 +40,17 @@ app.get("/v1/auth", (req, res) => {
|
||||
if(accounts[req.headers.username] === undefined)
|
||||
passed = false
|
||||
|
||||
if(bcrypt.compareSync(accounts[req.headers.username],req.headers.password))
|
||||
if(!bcrypt.compareSync(req.headers.password, accounts[req.headers.username]))
|
||||
passed = false
|
||||
|
||||
if(passed)
|
||||
console.log(passed);
|
||||
|
||||
if(passed){
|
||||
res.status(200).json(apikeys);
|
||||
else
|
||||
}
|
||||
else{
|
||||
res.status(401).send("You are not authorised");
|
||||
}
|
||||
|
||||
|
||||
fs.writeFile("access.log", `${logTime} : ${req.ip} API KEY REQUEST ${passed?"SUCCESS":"FAILED"}\n`, { flag: "a" }, callback => {});
|
||||
|
||||
Reference in New Issue
Block a user