summaryrefslogtreecommitdiff
path: root/packages/backend/src/server
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-10-19 10:42:18 +0200
committerMar0xy <marie@kaifa.ch>2023-10-19 10:42:18 +0200
commitc3f768181ae232a9ac03c69759f5508398b4cd55 (patch)
tree770632fcd423109b68679920f3201a7835631ffd /packages/backend/src/server
parentfix: system users not being set to approved on creation (diff)
downloadsharkey-c3f768181ae232a9ac03c69759f5508398b4cd55.tar.gz
sharkey-c3f768181ae232a9ac03c69759f5508398b4cd55.tar.bz2
sharkey-c3f768181ae232a9ac03c69759f5508398b4cd55.zip
fix: invite code not being marked as used
Fixes an issue where if approval and invite were enabled the code would stay as unused
Diffstat (limited to 'packages/backend/src/server')
-rw-r--r--packages/backend/src/server/api/SignupApiService.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts
index 418656fdbc..c07389d975 100644
--- a/packages/backend/src/server/api/SignupApiService.ts
+++ b/packages/backend/src/server/api/SignupApiService.ts
@@ -199,7 +199,7 @@ export class SignupApiService {
reply.code(204);
return;
} else if (instance.approvalRequiredForSignup) {
- await this.signupService.signup({
+ const { account } = await this.signupService.signup({
username, password, host, reason,
});
@@ -209,6 +209,14 @@ export class SignupApiService {
'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.');
}
+ if (ticket) {
+ await this.registrationTicketsRepository.update(ticket.id, {
+ usedAt: new Date(),
+ usedBy: account,
+ usedById: account.id,
+ });
+ }
+
reply.code(204);
return;
} else {