This commit is contained in:
Daniel Hougaard
2025-03-07 04:55:18 +04:00
parent 7003ad608a
commit c48c9ae628
2 changed files with 20 additions and 22 deletions
@@ -243,31 +243,27 @@ export const authPaswordServiceFactory = ({
const { tag, iv, ciphertext, encoding } = infisicalSymmetricEncypt(privateKey); const { tag, iv, ciphertext, encoding } = infisicalSymmetricEncypt(privateKey);
await userDAL.transaction(async (tx) => { await userDAL.updateUserEncryptionByUserId(userId, {
await userDAL.updateUserEncryptionByUserId( hashedPassword: newHashedPassword,
userId,
{
hashedPassword: newHashedPassword,
// srp params // srp params
salt: encKeys.salt, salt: encKeys.salt,
verifier: encKeys.verifier, verifier: encKeys.verifier,
protectedKey: encKeys.protectedKey, protectedKey: encKeys.protectedKey,
protectedKeyIV: encKeys.protectedKeyIV, protectedKeyIV: encKeys.protectedKeyIV,
protectedKeyTag: encKeys.protectedKeyTag, protectedKeyTag: encKeys.protectedKeyTag,
encryptedPrivateKey: encKeys.encryptedPrivateKey, encryptedPrivateKey: encKeys.encryptedPrivateKey,
iv: encKeys.encryptedPrivateKeyIV, iv: encKeys.encryptedPrivateKeyIV,
tag: encKeys.encryptedPrivateKeyTag, tag: encKeys.encryptedPrivateKeyTag,
serverEncryptedPrivateKey: ciphertext, serverEncryptedPrivateKey: ciphertext,
serverEncryptedPrivateKeyIV: iv, serverEncryptedPrivateKeyIV: iv,
serverEncryptedPrivateKeyTag: tag, serverEncryptedPrivateKeyTag: tag,
serverEncryptedPrivateKeyEncoding: encoding serverEncryptedPrivateKeyEncoding: encoding
},
tx
);
}); });
await tokenService.revokeAllMySessions(userId);
}; };
/* /*
@@ -13,6 +13,7 @@ import { Button, FormControl, Input } from "@app/components/v2";
import { useUser } from "@app/context"; import { useUser } from "@app/context";
import { useResetUserPasswordV2, useSendPasswordSetupEmail } from "@app/hooks/api/auth/queries"; import { useResetUserPasswordV2, useSendPasswordSetupEmail } from "@app/hooks/api/auth/queries";
import { UserEncryptionVersion } from "@app/hooks/api/auth/types"; import { UserEncryptionVersion } from "@app/hooks/api/auth/types";
import { useNavigate } from "@tanstack/react-router";
type Errors = { type Errors = {
tooShort?: string; tooShort?: string;
@@ -36,6 +37,7 @@ export type FormData = z.infer<typeof schema>;
export const ChangePasswordSection = () => { export const ChangePasswordSection = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate();
const { user } = useUser(); const { user } = useUser();
const { reset, control, handleSubmit } = useForm({ const { reset, control, handleSubmit } = useForm({
@@ -80,7 +82,7 @@ export const ChangePasswordSection = () => {
}); });
reset(); reset();
window.location.href = "/login"; navigate({ to: "/login" });
} catch (err) { } catch (err) {
console.error(err); console.error(err);
setIsLoading(false); setIsLoading(false);