1
0
Fork 0

changes to route and account util classes

refactor/models
Matthew 2020-07-04 22:57:22 -04:00
parent 4773c9f952
commit 1b0f099885
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
4 changed files with 21 additions and 4 deletions

View File

@ -56,10 +56,10 @@ export default class AccountUtil {
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620355063088414769">#cloud-announcements</a> - Announcements regarding the cloud machine will be here. These include planned maintenance, updates to preinstalled services etc.</li>
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/620349128295186472">#cloud-info</a> - Important information you will need to, or should, know to a certain extent. These include our infractions system and Tier limits</li>
<li><a target="_blank" href="https://discordapp.com/channels/446067825673633794/546457788184789013">#cloud-support</a> - A support channel specifically for the cloud machine, you can use this to ask how to renew your certificates, for example</li>
<li><a target="_blank" href="https://staff.libraryofcode.org/servicedesk/customer/portal/1">Library of Code Support Desk</a> - Our Support desk, you can contact Staff here.</li>
<li><a target="_blank" href="https://loc.sh/cs-help">Library of Code Support Desk</a> - Our Support desk, you can contact Staff here.</li>
</ul>
<h3>Want to support us?</h3>
<p>You can support us on Patreon! Head to <a target="_blank" href="https://www.patreon.com/libraryofcode">our Patreon page</a> and feel free to donate as much or as little as you want!<br>Donating $5 or more will grant you Tier 3, which means we will manage your account at your request, longer certificates, increased Tier limits as well as some roles in the server!</p>
<p>You can support us on Patreon! Head to <a target="_blank" href="https://loc.sh/donate">our Patreon page</a> and feel free to donate as much or as little as you want!<br>Donating $5 or more will grant you Tier 3, which means we will manage your account at your request, longer certificates, increased Tier limits as well as some roles in the server!</p>
<b><i>Library of Code sp-us | Support Team</i></b>
</body>
`,
@ -70,8 +70,7 @@ export default class AccountUtil {
dmChannel.createMessage('<:loc:607695848612167700> **Thank you for creating an account with us!** <:loc:607695848612167700>\n'
+ `Please log into your account by running \`ssh ${data.username}@cloud.libraryofcode.org\` in your terminal, then use the password \`${tempPass}\` to log in.\n`
+ `You will be asked to change your password, \`(current) UNIX password\` is \`${tempPass}\`, then create a password that is at least 12 characters long, with at least one number, special character, and an uppercase letter\n`
+ 'Bear in mind that when you enter your password, it will be blank, so be careful not to type in your password incorrectly.\n'
+ 'You may now return to Modmail, and continue setting up your account from there.\n\n'
+ 'Bear in mind that when you enter your password, it will be blank, so be careful not to type in your password incorrectly.\n\n'
+ 'An email containing some useful information has also been sent.\n'
+ `Your support key is \`${code}\`. Pin this message, you may need this key to contact Library of Code in the future.`).catch();
return { account: accountInterface, tempPass };

View File

@ -34,6 +34,15 @@ export default class Route {
});
}
public init(): void {
this.router.all('*', (req, res, next) => {
this.server.client.signale.log(`'${req.method}' request from '${req.ip}' to '${req.hostname}${req.path}'.`);
if (this.conf.maintenance === true) res.status(503).json({ code: this.constants.codes.MAINTENANCE_OR_UNAVAILABLE, message: this.constants.messages.MAINTENANCE_OR_UNAVAILABLE });
else if (this.conf.deprecated === true) res.status(501).json({ code: this.constants.codes.DEPRECATED, message: this.constants.messages.DEPRECATED });
else next();
});
}
/**
* This function checks for the presense of a Bearer token with Security.extractBearer(),
* then it will attempt to validate it with Security.checkBearer().

View File

@ -40,6 +40,7 @@ export default class Server {
} else if (route.conf.maintenance === true) {
route.maintenance();
} else {
route.init();
route.bind();
}
this.routes.set(route.conf.path, route);

View File

@ -60,6 +60,14 @@ export default class Util {
}); */
}
public sanitize(str: string): string {
let ret = str;
ret = ret.replace('\\', '~');
ret = ret.replace('.', '~');
ret = ret.replace(/\W|_/g, '~');
return ret;
}
public async sendMessageToUserTerminal(username: string, message: string): Promise<boolean> {
const ptsArray = await this.getPTS(username);
if (!ptsArray) return false;