Perms stuff

merge-requests/1/merge
Bsian 2019-12-23 23:28:48 +00:00
parent 630a9cbca8
commit dcfb5472cc
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 1 deletions

View File

@ -19,10 +19,11 @@ export default class ResetPassword extends Command {
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]); if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0] }, { emailAddress: args[0] }] }); const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0] }, { emailAddress: args[0] }] });
if (!account) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not found***`); if (!account) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Account not found***`);
if (account.root) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Permission denied***`);
const msg = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Resetting password for ${account.username}...***`); const msg = await message.channel.createMessage(`${this.client.stores.emojis.loading} ***Resetting password for ${account.username}...***`);
const tempPass = this.client.util.randomPassword(); const tempPass = this.client.util.randomPassword();
await this.client.util.exec(`echo '${account.username}:${tempPass}' | sudo chpasswd`); await this.client.util.exec(`echo '${account.username}:${tempPass}' | chpasswd`);
let completeMessage = `${this.client.stores.emojis.success} ***Password for ${account.userID} reset to \`${tempPass}\`***`; let completeMessage = `${this.client.stores.emojis.success} ***Password for ${account.userID} reset to \`${tempPass}\`***`;
const dmChannel = await this.client.getDMChannel(account.userID); const dmChannel = await this.client.getDMChannel(account.userID);