mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 21:28:18 +00:00
Requested changes
This commit is contained in:
@@ -180,7 +180,7 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
|||||||
encryptedPrivateKeyTag: z.string().trim(),
|
encryptedPrivateKeyTag: z.string().trim(),
|
||||||
salt: z.string().trim(),
|
salt: z.string().trim(),
|
||||||
verifier: z.string().trim(),
|
verifier: z.string().trim(),
|
||||||
metadata: z.string().optional()
|
tokenMetadata: z.string().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ export const authSignupServiceFactory = ({
|
|||||||
encryptedPrivateKeyIV,
|
encryptedPrivateKeyIV,
|
||||||
encryptedPrivateKeyTag,
|
encryptedPrivateKeyTag,
|
||||||
authorization,
|
authorization,
|
||||||
metadata
|
tokenMetadata
|
||||||
}: TCompleteAccountInviteDTO) => {
|
}: TCompleteAccountInviteDTO) => {
|
||||||
const user = await userDAL.findUserByUsername(email);
|
const user = await userDAL.findUserByUsername(email);
|
||||||
if (!user || (user && user.isAccepted)) {
|
if (!user || (user && user.isAccepted)) {
|
||||||
@@ -370,13 +370,13 @@ export const authSignupServiceFactory = ({
|
|||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
|
|
||||||
if (metadata) {
|
if (tokenMetadata) {
|
||||||
const metadataObj = jwt.verify(metadata, appCfg.AUTH_SECRET) as TTokenMetadata;
|
const metadataObj = jwt.verify(tokenMetadata, appCfg.AUTH_SECRET) as TTokenMetadata;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
metadataObj.payload.userId !== user.id ||
|
metadataObj?.payload?.userId !== user.id ||
|
||||||
metadataObj.payload.orgId !== orgMembership.orgId ||
|
metadataObj?.payload?.orgId !== orgMembership.orgId ||
|
||||||
metadataObj.type !== TokenMetadataType.InviteToProjects
|
metadataObj?.type !== TokenMetadataType.InviteToProjects
|
||||||
) {
|
) {
|
||||||
throw new UnauthorizedError({
|
throw new UnauthorizedError({
|
||||||
message: "Malformed or invalid metadata token"
|
message: "Malformed or invalid metadata token"
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ export type TCompleteAccountInviteDTO = {
|
|||||||
ip: string;
|
ip: string;
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
authorization: string;
|
authorization: string;
|
||||||
metadata?: string;
|
tokenMetadata?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -546,15 +546,11 @@ export const orgServiceFactory = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for await (const projectId of projectIds) {
|
await projectMembershipDAL.insertMany(
|
||||||
await projectMembershipDAL.create(
|
projectIds.map((id) => ({ projectId: id, userId: inviteeUser.id })),
|
||||||
{
|
|
||||||
projectId,
|
|
||||||
userId: inviteeUser.id
|
|
||||||
},
|
|
||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
|
for await (const projectId of projectIds) {
|
||||||
await addMembersToProject({
|
await addMembersToProject({
|
||||||
orgDAL,
|
orgDAL,
|
||||||
projectDAL,
|
projectDAL,
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export type CompleteAccountDTO = {
|
|||||||
salt: string;
|
salt: string;
|
||||||
verifier: string;
|
verifier: string;
|
||||||
password: string;
|
password: string;
|
||||||
metadata?: string;
|
tokenMetadata?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CompleteAccountSignupDTO = CompleteAccountDTO & {
|
export type CompleteAccountSignupDTO = CompleteAccountDTO & {
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export default function SignupInvite() {
|
|||||||
encryptedPrivateKeyTag,
|
encryptedPrivateKeyTag,
|
||||||
salt: result.salt,
|
salt: result.salt,
|
||||||
verifier: result.verifier,
|
verifier: result.verifier,
|
||||||
metadata
|
tokenMetadata: metadata
|
||||||
});
|
});
|
||||||
|
|
||||||
// unset temporary signup JWT token and set JWT token
|
// unset temporary signup JWT token and set JWT token
|
||||||
|
|||||||
Reference in New Issue
Block a user