From c77c2f57023cdd9c6ca5f1028a86ade8b1be8693 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Sat, 28 Mar 2020 04:57:24 -0400 Subject: [PATCH] have createaccount cmd use account utils instance --- src/commands/createaccount.ts | 66 ++--------------------------------- 1 file changed, 2 insertions(+), 64 deletions(-) diff --git a/src/commands/createaccount.ts b/src/commands/createaccount.ts index 8d7e6f6..9e6997f 100644 --- a/src/commands/createaccount.ts +++ b/src/commands/createaccount.ts @@ -37,71 +37,9 @@ export default class CreateAccount extends Command { if (!/^[a-z][-a-z0-9]*$/.test(args[2])) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid username supplied***`); const confirmation = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Creating account...***`); + const data = await this.client.util.accounts.createAccount({ userID: args[0], username: args[2], emailAddress: args[1] }, message.author.id); - const tempPass = this.client.util.randomPassword(); - let passHash = await this.client.util.createHash(tempPass); passHash = passHash.replace(/[$]/g, '\\$').replace('\n', ''); - const acctName = this.client.users.get(args[0]).username.replace(/[!@#$%^&*(),.?":{}|<>]/g, '-').replace(/\s/g, '-'); - const etcPasswd = `${acctName},${args[0]},,`; - - await this.client.util.createAccount(passHash, etcPasswd, args[2], args[0], args[1], message.author.id); - await this.client.util.createModerationLog(args[0], message.member, 0); - - this.client.util.transport.sendMail({ - to: args[1], - from: 'Library of Code sp-us | Cloud Services ', - subject: 'Your account has been created', - html: ` - - -

Library of Code | Cloud Services

-

Your Cloud Account has been created, welcome! Please see below for some details regarding your account and our services

-

Username: ${args[2]}

-

SSH Login:

ssh ${args[2]}@cloud.libraryofcode.org
-

Email address (see below for further information): ${args[2]}@cloud.libraryofcode.org

-

Useful information

-

How to log in:

-
    -
  1. Open your desired terminal application - we recommend using Bash, but you can use your computer's default
  2. -
  3. Type in your SSH Login as above
  4. -
  5. When prompted, enter your password Please note that inputs will be blank, so be careful not to type in your password incorrectly
  6. -
-

If you fail to authenticate yourself too many times, you will be IP banned and will fail to connect. If this is the case, feel free to DM Ramirez with your public IPv4 address. - -

Setting up your cloud email

-

All email applications are different, so here are some information you can use to connect your email

- -

Channels and Links

- -

Want to support us?

-

You can support us on Patreon! Head to our Patreon page and feel free to donate as much or as little as you want!
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!

- Library of Code sp-us | Support Team - - `, - }); - - const dmChannel = await this.client.getDMChannel(args[0]).catch(); - dmChannel.createMessage('<:loc:607695848612167700> **Thank you for creating an account with us!** <:loc:607695848612167700>\n' - + `Please log into your account by running \`ssh ${args[2]}@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' - + 'An email containing some useful information has also been sent').catch(); - - return confirmation.edit(`${this.client.stores.emojis.success} ***Account successfully created***\n**Username:** \`${args[2]}\`\n**Temporary Password:** \`${tempPass}\``); + return confirmation.edit(`${this.client.stores.emojis.success} ***Account successfully created***\n**Username:** \`${args[2]}\`\n**Temporary Password:** \`${data.tempPass}\``); } catch (error) { return this.client.util.handleError(error, message, this); }