feat(infisical-pg): fixed some bugs on org invite missing auth method

This commit is contained in:
Akhil Mohan
2024-01-27 12:38:23 +05:30
parent 3519412639
commit deb8e74749
5 changed files with 71 additions and 25 deletions
+2 -1
View File
@@ -245,7 +245,8 @@ export const registerRoutes = async (
const superAdminService = superAdminServiceFactory({
userDal,
authService: loginService,
serverCfgDal: superAdminDal
serverCfgDal: superAdminDal,
orgService
});
const apiKeyService = apiKeyServiceFactory({ apiKeyDal, userDal });
@@ -118,4 +118,35 @@ export const registerPasswordRouter = async (server: FastifyZodProvider) => {
return { message: "Successfully updated backup private key", backupPrivateKey };
}
});
server.route({
method: "POST",
url: "/password-reset",
onRequest: verifyAuth([AuthMode.JWT]),
schema: {
body: z.object({
protectedKey: z.string().trim(),
protectedKeyIV: z.string().trim(),
protectedKeyTag: z.string().trim(),
encryptedPrivateKey: z.string().trim(),
encryptedPrivateKeyIV: z.string().trim(),
encryptedPrivateKeyTag: z.string().trim(),
salt: z.string().trim(),
verifier: z.string().trim()
}),
response: {
200: z.object({
message: z.string()
})
}
},
handler: async (req) => {
await server.services.password.resetPasswordByBackupKey({
...req.body,
userId: req.permission.id
});
return { message: "Successfully updated backup private key" };
}
});
};