mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
send back invite url if no email service
This commit is contained in:
@@ -7,7 +7,7 @@ import { updateSubscriptionOrgQuantity } from '../../helpers/organization';
|
|||||||
import { sendMail } from '../../helpers/nodemailer';
|
import { sendMail } from '../../helpers/nodemailer';
|
||||||
import { TokenService } from '../../services';
|
import { TokenService } from '../../services';
|
||||||
import { OWNER, ADMIN, MEMBER, ACCEPTED, INVITED, TOKEN_EMAIL_ORG_INVITATION } from '../../variables';
|
import { OWNER, ADMIN, MEMBER, ACCEPTED, INVITED, TOKEN_EMAIL_ORG_INVITATION } from '../../variables';
|
||||||
import { getSiteURL, getJwtSignupLifetime, getJwtSignupSecret } from '../../config';
|
import { getSiteURL, getJwtSignupLifetime, getJwtSignupSecret, getSmtpConfigured } from '../../config';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete organization membership with id [membershipOrgId] from organization
|
* Delete organization membership with id [membershipOrgId] from organization
|
||||||
@@ -99,7 +99,7 @@ export const changeMembershipOrgRole = async (req: Request, res: Response) => {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const inviteUserToOrganization = async (req: Request, res: Response) => {
|
export const inviteUserToOrganization = async (req: Request, res: Response) => {
|
||||||
let invitee, inviteeMembershipOrg;
|
let invitee, inviteeMembershipOrg, completeInviteLink;
|
||||||
try {
|
try {
|
||||||
const { organizationId, inviteeEmail } = req.body;
|
const { organizationId, inviteeEmail } = req.body;
|
||||||
|
|
||||||
@@ -181,6 +181,10 @@ export const inviteUserToOrganization = async (req: Request, res: Response) => {
|
|||||||
callback_url: getSiteURL() + '/signupinvite'
|
callback_url: getSiteURL() + '/signupinvite'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!getSmtpConfigured()) {
|
||||||
|
completeInviteLink = `${getSiteURL() + '/signupinvite'}?token=${token}&to=${inviteeEmail}`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateSubscriptionOrgQuantity({ organizationId });
|
await updateSubscriptionOrgQuantity({ organizationId });
|
||||||
@@ -193,7 +197,8 @@ export const inviteUserToOrganization = async (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
message: `Sent an invite link to ${req.body.inviteeEmail}`
|
message: `Sent an invite link to ${req.body.inviteeEmail}`,
|
||||||
|
completeInviteLink
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export const verifyEmailSignup = async (req: Request, res: Response) => {
|
|||||||
const { email, code } = req.body;
|
const { email, code } = req.body;
|
||||||
|
|
||||||
// initialize user account
|
// initialize user account
|
||||||
user = await User.findOne({ email });
|
user = await User.findOne({ email }).select('+publicKey');
|
||||||
if (user && user?.publicKey) {
|
if (user && user?.publicKey) {
|
||||||
// case: user has already completed account
|
// case: user has already completed account
|
||||||
return res.status(403).send({
|
return res.status(403).send({
|
||||||
|
|||||||
Reference in New Issue
Block a user