set ram notification threshold default on account creation

merge-requests/4/head
Matthew 2020-05-03 17:48:40 -04:00
parent b5a1744002
commit c3f6867f4b
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 2 additions and 1 deletions

View File

@ -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> {
await this.exec(`useradd -m -p ${hash} -c ${etcPasswd} -s /bin/bash ${username}`);
await this.exec(`chage -d0 ${username}`);
const tier = await this.client.db.Tier.findOne({ id: 1 });
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();
}