forked from engineering/cloudservices
fixes
parent
91d7c1d8cf
commit
fc159089cb
|
@ -57,7 +57,7 @@ export default class Root extends Route {
|
|||
try {
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
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);
|
||||
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 = <TextChannel> 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);
|
||||
|
|
|
@ -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.');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue