allow admins to create approved users

This commit is contained in:
Hazelnoot 2024-10-26 16:47:39 -04:00
parent 1520bc1715
commit f36a1a5701
2 changed files with 21 additions and 15 deletions

View file

@ -55,6 +55,7 @@ export class SignupService {
host?: string | null;
reason?: string | null;
ignorePreservedUsernames?: boolean;
approved?: boolean;
}) {
const { username, password, passwordHash, host, reason } = opts;
let hash = passwordHash;
@ -115,9 +116,6 @@ export class SignupService {
));
let account!: MiUser;
let defaultApproval = false;
if (!this.meta.approvalRequiredForSignup) defaultApproval = true;
// Start transaction
await this.db.transaction(async transactionalEntityManager => {
@ -135,7 +133,7 @@ export class SignupService {
host: this.utilityService.toPunyNullable(host),
token: secret,
isRoot: isTheFirstUser,
approved: defaultApproval,
approved: opts.approved ?? !this.meta.approvalRequiredForSignup,
signupReason: reason,
}));