diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts
index 5e90fd63020d..8b30dadcbc94 100644
--- a/packages/backend/src/server/api/SignupApiService.ts
+++ b/packages/backend/src/server/api/SignupApiService.ts
@@ -174,6 +174,9 @@ export class SignupApiService {
}
if (this.meta.emailRequiredForSignup) {
+ if (!emailAddress) {
+ throw new FastifyReplyError(400, 'EMAIL_NOT_PROVIDED');
+ }
if (await this.usersRepository.exists({ where: { usernameLower: username.toLowerCase(), host: IsNull() } })) {
throw new FastifyReplyError(400, 'DUPLICATED_USERNAME');
}
@@ -197,7 +200,7 @@ export class SignupApiService {
const pendingUser = await this.userPendingsRepository.insertOne({
id: this.idService.gen(),
code,
- email: emailAddress!,
+ email: emailAddress,
username: username,
password: hash,
reason: reason,
@@ -205,7 +208,7 @@ export class SignupApiService {
const link = `${this.config.url}/signup-complete/${code}`;
- this.emailService.sendEmail(emailAddress!, 'Signup',
+ this.emailService.sendEmail(emailAddress, 'Signup',
`To complete signup, please click this link:
${link}`,
`To complete signup, please click this link: ${link}`);
@@ -225,8 +228,8 @@ export class SignupApiService {
if (emailAddress) {
this.emailService.sendEmail(emailAddress, 'Approval pending',
- 'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.',
- 'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.');
+ 'Your account is now pending approval.
You will get notified when you have been accepted.',
+ 'Your account is now pending approval. You will get notified when you have been accepted.');
}
if (ticket) {
@@ -323,8 +326,8 @@ export class SignupApiService {
if (this.meta.approvalRequiredForSignup) {
if (pendingUser.email) {
this.emailService.sendEmail(pendingUser.email, 'Approval pending',
- 'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.',
- 'Congratulations! Your account is now pending approval. You will get notified when you have been accepted.');
+ 'Your account is now pending approval. You will get notified when you have been accepted.',
+ 'Your account is now pending approval. You will get notified when you have been accepted.');
}
const moderators = await this.roleService.getModerators();
diff --git a/packages/backend/src/server/api/endpoints/admin/approve-user.ts b/packages/backend/src/server/api/endpoints/admin/approve-user.ts
index 0f5945440cbd..14c37c963c30 100644
--- a/packages/backend/src/server/api/endpoints/admin/approve-user.ts
+++ b/packages/backend/src/server/api/endpoints/admin/approve-user.ts
@@ -54,8 +54,8 @@ export default class extends Endpoint { // eslint-
if (profile?.email) {
this.emailService.sendEmail(profile.email, 'Account Approved',
- 'Your Account has been approved have fun socializing!',
- 'Your Account has been approved have fun socializing!');
+ 'Your Account has been approved!
Have fun socializing!',
+ 'Your Account has been approved! Have fun socializing!');
}
this.moderationLogService.log(me, 'approve', {
diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts
index 5f1651940345..19b0658170c2 100644
--- a/packages/backend/src/server/api/endpoints/admin/show-users.ts
+++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts
@@ -64,7 +64,7 @@ export default class extends Endpoint { // eslint-
case 'available': query.where('user.isSuspended = FALSE'); break;
case 'alive': query.where('user.updatedAt > :date', { date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 5) }); break;
case 'suspended': query.where('user.isSuspended = TRUE'); break;
- case 'approved': query.where('user.approved = FALSE'); break;
+ case 'approved': query.where('user.approved = TRUE'); break;
case 'admin': {
const adminIds = await this.roleService.getAdministratorIds();
if (adminIds.length === 0) return [];
diff --git a/packages/backend/src/types.ts b/packages/backend/src/types.ts
index e2207cb7a08f..5dc5cdef6672 100644
--- a/packages/backend/src/types.ts
+++ b/packages/backend/src/types.ts
@@ -132,7 +132,7 @@ export type ModerationLogPayloads = {
approve: {
userId: string;
userUsername: string;
- userHost: string | null;
+ //userHost: string | null; // User approval is local action
};
unsuspend: {
userId: string;