diff --git a/src/api/routes/Root.ts b/src/api/routes/Root.ts index be1185f..6eb04f4 100644 --- a/src/api/routes/Root.ts +++ b/src/api/routes/Root.ts @@ -57,7 +57,7 @@ export default class Root extends Route { try { res.setHeader('Access-Control-Allow-Origin', '*'); const token = jwt.verify(req.query.t.toString(), this.server.client.config.keyPair.privateKey); - const check = await this.server.storage.get(token); + const check = await this.server.storage.get(req.query.t.toString()); if (check) return res.sendStatus(401); const embed = new RichEmbed(); embed.setTitle('Referral Authorization'); @@ -66,7 +66,7 @@ export default class Root extends Route { embed.addField('Referral Code', token.referralCode, true); const channel = this.server.client.guilds.get('446067825673633794').channels.get('580950455581147146'); res.sendStatus(200); - await this.server.storage.set(token, true); + await this.server.storage.set(req.query.t.toString(), true); return channel.createMessage({ content: `<@${token.staffUserID}>`, embed }); } catch { return res.sendStatus(401); diff --git a/src/commands/authreferral.ts b/src/commands/authreferral.ts index 3d82770..b28530f 100644 --- a/src/commands/authreferral.ts +++ b/src/commands/authreferral.ts @@ -23,7 +23,7 @@ export default class AuthReferral extends Command { const token = jwt.sign({ staffUserID: message.author.id, referralCode: referrer.referralCode, referrerUserID: referrer.userID, referrerUsername: referrer.username, referredUserID: referred.id, referredUserAndDiscrim: `${referred.username}#${referred.discriminator}` }, this.client.config.keyPair.privateKey, { expiresIn: '24 hours', issuer: 'Library of Code sp-us | Cloud Services Daemon' }); this.client.getDMChannel(referrer.userID).then((chan) => { - chan.createMessage(`__**Referral Request Authorization**__\nYour referral code has been used in an application recently submitted to us. We need to authorize this request, please visit https://loc.sh/rv and enter the authorization token below. This token expires in 24 hours. If you did not authorize this request, please contact us immediately by DMing Ramirez or opening a ticket at https://loc.sh/cs-help.\n\n\`${token}\``); + chan.createMessage(`__**Referral Request Authorization**__\nYour referral code has been used in an application recently submitted to us. We need to authorize this request, please visit https://loc.sh/rv and enter the authorization token below. This token expires in 24 hours. If you did not authorize this request, please contact us immediately by DMing Ramirez or opening a ticket at https://loc.sh/cs-help.\n**Referred User:** ${referred.username}#${referred.discriminator} | <@${referred.user.id}>\n\n\`${token}\``); }).catch(() => { this.error(message.channel, 'Could not DM referrer.'); });