mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Do not return inviteAcceptUrl in response if email was sent (#7465)
This commit is contained in:
committed by
GitHub
parent
ab6a9bbac2
commit
55c6a1b0d3
@@ -10,7 +10,6 @@ import {
|
||||
generateUserInviteUrl,
|
||||
getInstanceBaseUrl,
|
||||
hashPassword,
|
||||
isEmailSetUp,
|
||||
validatePassword,
|
||||
} from '@/UserManagement/UserManagementHelper';
|
||||
import { issueCookie } from '@/auth/jwt';
|
||||
@@ -184,7 +183,7 @@ export class UsersController {
|
||||
}
|
||||
const inviteAcceptUrl = generateUserInviteUrl(req.user.id, id);
|
||||
const resp: {
|
||||
user: { id: string | null; email: string; inviteAcceptUrl: string; emailSent: boolean };
|
||||
user: { id: string | null; email: string; inviteAcceptUrl?: string; emailSent: boolean };
|
||||
error?: string;
|
||||
} = {
|
||||
user: {
|
||||
@@ -202,6 +201,7 @@ export class UsersController {
|
||||
});
|
||||
if (result.emailSent) {
|
||||
resp.user.emailSent = true;
|
||||
delete resp.user.inviteAcceptUrl;
|
||||
void this.internalHooks.onUserTransactionalEmail({
|
||||
user_id: id,
|
||||
message_type: 'New user invite',
|
||||
@@ -619,7 +619,7 @@ export class UsersController {
|
||||
throw new UnauthorizedError(RESPONSE_ERROR_MESSAGES.USERS_QUOTA_REACHED);
|
||||
}
|
||||
|
||||
if (!isEmailSetUp()) {
|
||||
if (!this.mailer.isEmailSetUp) {
|
||||
this.logger.error('Request to reinvite a user failed because email sending was not set up');
|
||||
throw new InternalServerError('Email sending must be set up in order to invite other users');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user