merge-requests/4/head
Matthew 2020-08-30 22:17:07 -04:00
parent 91d7c1d8cf
commit fc159089cb
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 3 additions and 3 deletions

View File

@ -57,7 +57,7 @@ export default class Root extends Route {
try { try {
res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Origin', '*');
const token = <any> jwt.verify(req.query.t.toString(), this.server.client.config.keyPair.privateKey); const token = <any> jwt.verify(req.query.t.toString(), this.server.client.config.keyPair.privateKey);
const check = await this.server.storage.get<boolean>(token); const check = await this.server.storage.get<boolean>(req.query.t.toString());
if (check) return res.sendStatus(401); if (check) return res.sendStatus(401);
const embed = new RichEmbed(); const embed = new RichEmbed();
embed.setTitle('Referral Authorization'); embed.setTitle('Referral Authorization');
@ -66,7 +66,7 @@ export default class Root extends Route {
embed.addField('Referral Code', token.referralCode, true); embed.addField('Referral Code', token.referralCode, true);
const channel = <TextChannel> this.server.client.guilds.get('446067825673633794').channels.get('580950455581147146'); const channel = <TextChannel> this.server.client.guilds.get('446067825673633794').channels.get('580950455581147146');
res.sendStatus(200); 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 }); return channel.createMessage({ content: `<@${token.staffUserID}>`, embed });
} catch { } catch {
return res.sendStatus(401); return res.sendStatus(401);

View File

@ -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' }); 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) => { 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(() => { }).catch(() => {
this.error(message.channel, 'Could not DM referrer.'); this.error(message.channel, 'Could not DM referrer.');
}); });