1
0
Fork 0

return the interface in util cacc

refactor/models
Matthew 2019-10-30 20:49:15 -04:00
parent 613c709e52
commit 40872f00e3
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import uuid from 'uuid/v4';
import moment from 'moment'; import moment from 'moment';
import { Client } from '..'; import { Client } from '..';
import { Command, RichEmbed } from '.'; import { Command, RichEmbed } from '.';
import { ModerationInterface } from '../models'; import { ModerationInterface, AccountInterface } from '../models';
export default class Util { export default class Util {
public client: Client; public client: Client;
@ -121,14 +121,14 @@ export default class Util {
return tempPass; return tempPass;
} }
public async createAccount(hash: string, etcPasswd: string, username: string, userID: string, emailAddress: string, moderatorID: string): Promise<void> { public async createAccount(hash: string, etcPasswd: string, username: string, userID: string, emailAddress: string, moderatorID: string): Promise<AccountInterface> {
await this.exec(`useradd -m -p ${hash} -c ${etcPasswd} -s /bin/bash ${username}`); await this.exec(`useradd -m -p ${hash} -c ${etcPasswd} -s /bin/bash ${username}`);
await this.exec(`chage -d0 ${username}`); await this.exec(`chage -d0 ${username}`);
const account = await new this.client.db.Account({ const account = await new this.client.db.Account({
username, userID, emailAddress, createdBy: moderatorID, createdAt: new Date(), locked: false, username, userID, emailAddress, createdBy: moderatorID, createdAt: new Date(), locked: false,
}); });
await account.save(); return account.save();
} }
public async deleteAccount(username: string): Promise<void> { public async deleteAccount(username: string): Promise<void> {