Compare commits
No commits in common. "276467519f828de3eb8423c3f6099510207e598a" and "f231cc4fdd97c7cb40534f4f50846900b095f5c6" have entirely different histories.
276467519f
...
f231cc4fdd
|
@ -41,12 +41,12 @@ export default class AccountUtil {
|
||||||
subject: 'Approval for CS Account',
|
subject: 'Approval for CS Account',
|
||||||
html: `
|
html: `
|
||||||
<body>
|
<body>
|
||||||
<style>* {font-family: 'Calibri',sans-serif;}</style>
|
<style>* {font-family: 'Calibri';}</style>
|
||||||
<h1>Library of Code | Cloud Services</h1>
|
<h1>Library of Code | Cloud Services</h1>
|
||||||
<h2>Congratulations, your CS Account application has been approved. Welcome! Please see below for some details regarding your account and our services</h2>
|
<h2>Congratulations, your CS Account application has been approved. Welcome! Please see below for some details regarding your account and our services</h2>
|
||||||
<p><b>Username:</b> ${data.username}</p>
|
<p><b>Username:</b> ${data.username}</p>
|
||||||
<p><b>Support Key:</b> ${code} || <i>You may be asked for this support key when contacting Library of Code, please keep the code in a safe area.</i></p>
|
<p><b>Support Key:</b> ${code} || <i>You may be asked for this support key when contacting Library of Code, please keep the code in a safe area.</i></p>
|
||||||
<p><b>SSH Login:</b> <pre><code style="font-family: Courier,sans-serif;">ssh ${data.username}@cloud.libraryofcode.org</code></pre>
|
<p><b>SSH Login:</b> <pre><code style="font-family: Courier;">ssh ${data.username}@cloud.libraryofcode.org</code></pre>
|
||||||
<p><b>Underwritten by:</b> ${moderatorMember.user.username}${find.isManager ? ' [k]' : ' '}</p>
|
<p><b>Underwritten by:</b> ${moderatorMember.user.username}${find.isManager ? ' [k]' : ' '}</p>
|
||||||
<h2>Useful information</h2>
|
<h2>Useful information</h2>
|
||||||
<h3>How to log in:</h3>
|
<h3>How to log in:</h3>
|
||||||
|
@ -76,16 +76,12 @@ export default class AccountUtil {
|
||||||
const member = guild.members.cache.get(data.userID);
|
const member = guild.members.cache.get(data.userID);
|
||||||
await member.roles.add('546457886440685578');
|
await member.roles.add('546457886440685578');
|
||||||
const user = this.client.users.cache.get(data.userID);
|
const user = this.client.users.cache.get(data.userID);
|
||||||
try {
|
user.send('<:loc:607695848612167700> **Thank you for creating an account with us!** <:loc:607695848612167700>\n'
|
||||||
await user.send('<: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`
|
+ `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`
|
+ `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\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'
|
+ '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.`);
|
+ `Your support key is \`${code}\`. Pin this message, you may need this key to contact Library of Code in the future.`).catch();
|
||||||
} catch (error) {
|
|
||||||
this.client.util.handleError(error);
|
|
||||||
}
|
|
||||||
return { account: accountInterface, tempPass };
|
return { account: accountInterface, tempPass };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,18 @@
|
||||||
/* eslint-disable no-await-in-loop */
|
/* eslint-disable no-await-in-loop */
|
||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {randomBytes} from 'crypto';
|
import { randomBytes } from 'crypto';
|
||||||
import childProcess from 'child_process';
|
import childProcess from 'child_process';
|
||||||
import nodemailer from 'nodemailer';
|
import nodemailer from 'nodemailer';
|
||||||
import {ColorResolvable, DMChannel, Message, MessageEmbed, TextChannel, User} from 'discord.js';
|
import { Message, DMChannel, User, MessageEmbed, ColorResolvable, TextChannel } from 'discord.js';
|
||||||
import {v4 as uuid} from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import hastebin from 'hastebin-gen';
|
import hastebin from 'hastebin-gen';
|
||||||
import {getUserByUid} from '../functions';
|
import { getUserByUid } from '../functions';
|
||||||
import {AccountUtil, Client, Command, PaginationEmbed} from '.';
|
import { AccountUtil, Client, Command, PaginationEmbed } from '.';
|
||||||
import {AccountInterface, ModerationInterface} from '../models';
|
import { ModerationInterface, AccountInterface } from '../models';
|
||||||
import {Certificate} from '../../types/x509';
|
import { Certificate } from '../../types/x509';
|
||||||
|
|
||||||
export default class Util {
|
export default class Util {
|
||||||
public client: Client;
|
public client: Client;
|
||||||
|
@ -46,7 +46,7 @@ export default class Util {
|
||||||
cmd.stdout.on('data', writeFunction);
|
cmd.stdout.on('data', writeFunction);
|
||||||
cmd.stderr.on('data', writeFunction);
|
cmd.stderr.on('data', writeFunction);
|
||||||
cmd.on('error', writeFunction);
|
cmd.on('error', writeFunction);
|
||||||
cmd.once('close', (code) => {
|
cmd.once('close', (code, signal) => {
|
||||||
cmd.stdout.off('data', writeFunction);
|
cmd.stdout.off('data', writeFunction);
|
||||||
cmd.stderr.off('data', writeFunction);
|
cmd.stderr.off('data', writeFunction);
|
||||||
cmd.off('error', writeFunction);
|
cmd.off('error', writeFunction);
|
||||||
|
@ -184,14 +184,16 @@ export default class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createHash(password: string): Promise<string> {
|
public async createHash(password: string): Promise<string> {
|
||||||
return this.exec(`mkpasswd -m sha-512 "${password}"`);
|
const hashed = await this.exec(`mkpasswd -m sha-512 "${password}"`);
|
||||||
|
return hashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public isValidEmail(email: string): boolean {
|
public isValidEmail(email: string): boolean {
|
||||||
const checkAt = email.indexOf('@');
|
const checkAt = email.indexOf('@');
|
||||||
if (checkAt < 1) return false;
|
if (checkAt < 1) return false;
|
||||||
const checkDomain = email.indexOf('.', checkAt + 2);
|
const checkDomain = email.indexOf('.', checkAt + 2);
|
||||||
return checkDomain >= checkAt;
|
if (checkDomain < checkAt) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public randomPassword(): string {
|
public randomPassword(): string {
|
||||||
|
@ -274,7 +276,7 @@ export default class Util {
|
||||||
} else date = null;
|
} else date = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const expiration: { date: Date; processed: boolean } = { date, processed };
|
const expiration = { date, processed };
|
||||||
|
|
||||||
logInput.expiration = expiration;
|
logInput.expiration = expiration;
|
||||||
const log = new this.client.db.Moderation(logInput);
|
const log = new this.client.db.Moderation(logInput);
|
||||||
|
@ -288,8 +290,8 @@ export default class Util {
|
||||||
case 0: archType = 'Technician'; embedTitle = 'Cloud Account | Create'; color = '#00ff00'; break;
|
case 0: archType = 'Technician'; embedTitle = 'Cloud Account | Create'; color = '#00ff00'; break;
|
||||||
case 1: archType = 'Technician'; embedTitle = 'Account Warning | Warn'; color = '#ffff00'; break;
|
case 1: archType = 'Technician'; embedTitle = 'Account Warning | Warn'; color = '#ffff00'; break;
|
||||||
case 2: archType = 'Technician'; embedTitle = 'Account Infraction | Lock'; color = '#ff6600'; break;
|
case 2: archType = 'Technician'; embedTitle = 'Account Infraction | Lock'; color = '#ff6600'; break;
|
||||||
case 3: archType = 'Technician'; embedTitle = 'Account Infraction | Unlock'; color = '#0099ff'; break;
|
case 3: archType = 'Technician'; embedTitle = 'Account Reclaim | Unlock'; color = '#0099ff'; break;
|
||||||
case 4: archType = 'Manager'; embedTitle = 'Cloud Account | Delete'; color = '#ff0000'; break;
|
case 4: archType = 'Director'; embedTitle = 'Cloud Account | Delete'; color = '#ff0000'; break;
|
||||||
}
|
}
|
||||||
const req = await axios.get('https://loc.sh/int/directory');
|
const req = await axios.get('https://loc.sh/int/directory');
|
||||||
const find = req.data.find((mem) => mem.userID === moderator.id);
|
const find = req.data.find((mem) => mem.userID === moderator.id);
|
||||||
|
|
|
@ -31,7 +31,8 @@ export default class ResetPassword extends Command {
|
||||||
+ `You will be asked to change your password when you log back in, \`(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`
|
+ `You will be asked to change your password when you log back in, \`(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.');
|
+ 'Bear in mind that when you enter your password, it will be blank, so be careful not to type in your password incorrectly.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
completeMessage += '\n*Unable to DM user*';
|
if (error.code === 50007) completeMessage += '\n*Unable to DM user*';
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
return msg.edit(completeMessage);
|
return msg.edit(completeMessage);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue