forked from engineering/cloudservices
set ram notification threshold default on account creation
parent
b5a1744002
commit
c3f6867f4b
|
@ -150,9 +150,10 @@ export default class Util {
|
||||||
public async createAccount(hash: string, etcPasswd: string, username: string, userID: string, emailAddress: string, moderatorID: string, code: string): Promise<AccountInterface> {
|
public async createAccount(hash: string, etcPasswd: string, username: string, userID: string, emailAddress: string, moderatorID: string, code: 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 tier = await this.client.db.Tier.findOne({ id: 1 });
|
||||||
|
|
||||||
const account = new this.client.db.Account({
|
const account = new this.client.db.Account({
|
||||||
username, userID, emailAddress, createdBy: moderatorID, createdAt: new Date(), locked: false, tier: 1, supportKey: code, ssInit: false, homepath: `/home/${username}`,
|
username, userID, emailAddress, createdBy: moderatorID, ramLimitNotification: tier.resourceLimits.ram - 20, createdAt: new Date(), locked: false, tier: 1, supportKey: code, ssInit: false, homepath: `/home/${username}`,
|
||||||
});
|
});
|
||||||
return account.save();
|
return account.save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue