1
0
Fork 0

fix bullshit

refactor/models
Matthew 2020-07-01 17:58:06 -04:00
parent 1bc6b7c625
commit 4773c9f952
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
2 changed files with 7 additions and 6 deletions

View File

@ -22,13 +22,13 @@ export default class ResetPassword extends Command {
const msg = await this.loading(message.channel, `Resetting password for ${account.username}...`);
const tempPass = this.client.util.randomPassword();
await this.client.util.exec(`echo '${account.username}:${tempPass}' | chpasswd && chage -d0 ${account.username}`);
await this.client.util.exec(`echo '${account.username}:${tempPass}@' | chpasswd && chage -d0 ${account.username}`);
let completeMessage = `${this.client.stores.emojis.success} ***Password for ${account.username} reset to \`${tempPass}\`***`;
let completeMessage = `${this.client.stores.emojis.success} ***Password for ${account.username} reset to \`${tempPass}@\`***`;
const dmChannel = await this.client.getDMChannel(account.userID);
try {
await dmChannel.createMessage(`We received a password reset request from you, your new password is \`${tempPass}\`.\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`
await dmChannel.createMessage(`We received a password reset request from you, your new password is \`${tempPass}@\`.\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.');
} catch (error) {
if (error.code === 50007) completeMessage += '\n*Unable to DM user*';

View File

@ -15,11 +15,12 @@ export default class SystemD_Status extends Command {
if (!args[0]) return this.client.commands.get('help').run(message, ['systemd', this.name]);
const account = await this.client.db.Account.findOne({ userID: message.author.id }).lean().exec();
if (!account) return this.error(message.channel, 'You do not have a Cloud Services account.');
let cmd: string;
let cmd: string = '';
try {
cmd = await this.client.util.exec(`runuser ${account.username} -c 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\${UID}/bus" systemctl --user status ${args[0]}'`);
cmd += await this.client.util.exec(`runuser ${account.username} -c 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\${UID}/bus" systemctl --user status ${args[0]}'`);
} catch (err) {
if (err.toString().includes('could not be found')) return this.error(message.channel, 'The service name you provided doesn\'t exist.');
return this.error(message.channel, err.toString());
}
const embed = new RichEmbed();
embed.setTitle(`SystemD Status | ${args[0]}`);