parent
dd35b8a9d2
commit
e71b449554
15
src/Util.ts
15
src/Util.ts
|
@ -4,7 +4,6 @@ import childProcess from 'child_process';
|
||||||
import nodemailer from 'nodemailer';
|
import nodemailer from 'nodemailer';
|
||||||
import { Message, TextChannel, PrivateChannel } from 'eris';
|
import { Message, TextChannel, PrivateChannel } from 'eris';
|
||||||
import { outputFile } from 'fs-extra';
|
import { outputFile } from 'fs-extra';
|
||||||
import uuid from 'uuid/v4';
|
|
||||||
import { Client } from '.';
|
import { Client } from '.';
|
||||||
import { Command, RichEmbed } from './class';
|
import { Command, RichEmbed } from './class';
|
||||||
|
|
||||||
|
@ -113,18 +112,4 @@ export default class Util {
|
||||||
tempPass += passChars[Math.floor(Math.random() * passChars.length)];
|
tempPass += passChars[Math.floor(Math.random() * passChars.length)];
|
||||||
return tempPass;
|
return tempPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async createAccount(hash: string, etcPasswd: string, username: string, userID: string, emailAddress: string, moderatorID: string): Promise<void> {
|
|
||||||
await this.exec(`useradd -m -p ${hash} -c ${etcPasswd} -s /bin/bash ${username}`);
|
|
||||||
await this.exec(`chage -d0 ${username}`);
|
|
||||||
|
|
||||||
const log = await new this.client.db.Moderation({
|
|
||||||
username, userID, logID: uuid(), moderatorID, reason: 'User requested account creation', type: 0, date: new Date(),
|
|
||||||
});
|
|
||||||
const account = await new this.client.db.Account({
|
|
||||||
username, userID, emailAddress, createdBy: moderatorID, createdAt: new Date(), locked: false,
|
|
||||||
});
|
|
||||||
await log.save();
|
|
||||||
await account.save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue