pull/29/head
Matthew 2020-10-14 19:57:02 -04:00
parent 4620fd41f6
commit f1a28fa171
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 2 additions and 2 deletions

View File

@ -202,7 +202,7 @@ export default class Internal extends Route {
this.router.get('/id', async (req, res) => { this.router.get('/id', async (req, res) => {
try { try {
if (req.query?.auth.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); if (req.query?.auth?.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED });
if (!req.query.pin) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR }); if (!req.query.pin) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
const args = req.query.pin.toString(); const args = req.query.pin.toString();
const user = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec(); const user = await this.server.client.db.Score.findOne({ pin: [Number(args.split('-')[0]), Number(args.split('-')[1]), Number(args.split('-')[2])] }).lean().exec();
@ -215,7 +215,7 @@ export default class Internal extends Route {
this.router.get('/pin', async (req, res) => { this.router.get('/pin', async (req, res) => {
try { try {
if (req.query?.auth.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED }); if (req.query?.auth?.toString() !== this.server.client.config.internalKey) return res.status(401).json({ code: this.constants.codes.UNAUTHORIZED, message: this.constants.messages.UNAUTHORIZED });
if (!req.query.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR }); if (!req.query.id) return res.status(400).json({ code: this.constants.codes.CLIENT_ERROR });
const report = await this.server.client.db.Score.findOne({ userID: req.query.id.toString() }); const report = await this.server.client.db.Score.findOne({ userID: req.query.id.toString() });