Compare commits
6 Commits
f231cc4fdd
...
276467519f
Author | SHA1 | Date |
---|---|---|
Matthew | 276467519f | |
Matthew | 77e50b61c5 | |
Matthew | 60683688ce | |
Matthew | 3d930792fe | |
Matthew | 9d9485700a | |
Matthew | 88e2273f5f |
|
@ -41,12 +41,12 @@ export default class AccountUtil {
|
|||
subject: 'Approval for CS Account',
|
||||
html: `
|
||||
<body>
|
||||
<style>* {font-family: 'Calibri';}</style>
|
||||
<style>* {font-family: 'Calibri',sans-serif;}</style>
|
||||
<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>
|
||||
<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>SSH Login:</b> <pre><code style="font-family: Courier;">ssh ${data.username}@cloud.libraryofcode.org</code></pre>
|
||||
<p><b>SSH Login:</b> <pre><code style="font-family: Courier,sans-serif;">ssh ${data.username}@cloud.libraryofcode.org</code></pre>
|
||||
<p><b>Underwritten by:</b> ${moderatorMember.user.username}${find.isManager ? ' [k]' : ' '}</p>
|
||||
<h2>Useful information</h2>
|
||||
<h3>How to log in:</h3>
|
||||
|
@ -76,12 +76,16 @@ export default class AccountUtil {
|
|||
const member = guild.members.cache.get(data.userID);
|
||||
await member.roles.add('546457886440685578');
|
||||
const user = this.client.users.cache.get(data.userID);
|
||||
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`
|
||||
+ `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'
|
||||
+ '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();
|
||||
try {
|
||||
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`
|
||||
+ `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'
|
||||
+ '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 (error) {
|
||||
this.client.util.handleError(error);
|
||||
}
|
||||
return { account: accountInterface, tempPass };
|
||||
}
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-param-reassign */
|
||||
import axios from 'axios';
|
||||
import { randomBytes } from 'crypto';
|
||||
import {randomBytes} from 'crypto';
|
||||
import childProcess from 'child_process';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { Message, DMChannel, User, MessageEmbed, ColorResolvable, TextChannel } from 'discord.js';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import {ColorResolvable, DMChannel, Message, MessageEmbed, TextChannel, User} from 'discord.js';
|
||||
import {v4 as uuid} from 'uuid';
|
||||
import moment from 'moment';
|
||||
import fs from 'fs';
|
||||
import hastebin from 'hastebin-gen';
|
||||
import { getUserByUid } from '../functions';
|
||||
import { AccountUtil, Client, Command, PaginationEmbed } from '.';
|
||||
import { ModerationInterface, AccountInterface } from '../models';
|
||||
import { Certificate } from '../../types/x509';
|
||||
import {getUserByUid} from '../functions';
|
||||
import {AccountUtil, Client, Command, PaginationEmbed} from '.';
|
||||
import {AccountInterface, ModerationInterface} from '../models';
|
||||
import {Certificate} from '../../types/x509';
|
||||
|
||||
export default class Util {
|
||||
public client: Client;
|
||||
|
@ -46,7 +46,7 @@ export default class Util {
|
|||
cmd.stdout.on('data', writeFunction);
|
||||
cmd.stderr.on('data', writeFunction);
|
||||
cmd.on('error', writeFunction);
|
||||
cmd.once('close', (code, signal) => {
|
||||
cmd.once('close', (code) => {
|
||||
cmd.stdout.off('data', writeFunction);
|
||||
cmd.stderr.off('data', writeFunction);
|
||||
cmd.off('error', writeFunction);
|
||||
|
@ -184,16 +184,14 @@ export default class Util {
|
|||
}
|
||||
|
||||
public async createHash(password: string): Promise<string> {
|
||||
const hashed = await this.exec(`mkpasswd -m sha-512 "${password}"`);
|
||||
return hashed;
|
||||
return this.exec(`mkpasswd -m sha-512 "${password}"`);
|
||||
}
|
||||
|
||||
public isValidEmail(email: string): boolean {
|
||||
const checkAt = email.indexOf('@');
|
||||
if (checkAt < 1) return false;
|
||||
const checkDomain = email.indexOf('.', checkAt + 2);
|
||||
if (checkDomain < checkAt) return false;
|
||||
return true;
|
||||
return checkDomain >= checkAt;
|
||||
}
|
||||
|
||||
public randomPassword(): string {
|
||||
|
@ -276,7 +274,7 @@ export default class Util {
|
|||
} else date = null;
|
||||
}
|
||||
|
||||
const expiration = { date, processed };
|
||||
const expiration: { date: Date; processed: boolean } = { date, processed };
|
||||
|
||||
logInput.expiration = expiration;
|
||||
const log = new this.client.db.Moderation(logInput);
|
||||
|
@ -290,8 +288,8 @@ export default class Util {
|
|||
case 0: archType = 'Technician'; embedTitle = 'Cloud Account | Create'; color = '#00ff00'; break;
|
||||
case 1: archType = 'Technician'; embedTitle = 'Account Warning | Warn'; color = '#ffff00'; break;
|
||||
case 2: archType = 'Technician'; embedTitle = 'Account Infraction | Lock'; color = '#ff6600'; break;
|
||||
case 3: archType = 'Technician'; embedTitle = 'Account Reclaim | Unlock'; color = '#0099ff'; break;
|
||||
case 4: archType = 'Director'; embedTitle = 'Cloud Account | Delete'; color = '#ff0000'; break;
|
||||
case 3: archType = 'Technician'; embedTitle = 'Account Infraction | Unlock'; color = '#0099ff'; break;
|
||||
case 4: archType = 'Manager'; embedTitle = 'Cloud Account | Delete'; color = '#ff0000'; break;
|
||||
}
|
||||
const req = await axios.get('https://loc.sh/int/directory');
|
||||
const find = req.data.find((mem) => mem.userID === moderator.id);
|
||||
|
|
|
@ -31,8 +31,7 @@ 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`
|
||||
+ '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) {
|
||||
if (error.code === 50007) completeMessage += '\n*Unable to DM user*';
|
||||
throw error;
|
||||
completeMessage += '\n*Unable to DM user*';
|
||||
}
|
||||
return msg.edit(completeMessage);
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue