Skip to content

The Open Source DocuSign Alternative.

fix: minor tidying

Mythie5cba252627d4
diff --git a/apps/web/src/components/forms/password.tsx b/apps/web/src/components/forms/password.tsx
index de0b9f1e0..a9bd81af4 100644
--- a/apps/web/src/components/forms/password.tsx
+++ b/apps/web/src/components/forms/password.tsx
@@ -80,7 +80,7 @@ export const PasswordForm = ({ className }: PasswordFormProps) => {
title: 'An unknown error occurred',
variant: 'destructive',
description:
- 'We encountered an unknown error while attempting to sign you In. Please try again later.',
+ 'We encountered an unknown error while attempting to update your password. Please try again later.',
});
}
}
diff --git a/packages/lib/server-only/user/update-password.ts b/packages/lib/server-only/user/update-password.ts
index 521aecd22..4133bc342 100644
--- a/packages/lib/server-only/user/update-password.ts
+++ b/packages/lib/server-only/user/update-password.ts
@@ -23,7 +23,7 @@ export const updatePassword = async ({ userId, password }: UpdatePasswordOptions
const isSamePassword = await compare(password, user.password as string);
if (isSamePassword) {
- throw new Error('You cannot use the same password as your current password.');
+ throw new Error('Your new password cannot be the same as your old password.');
}
const updatedUser = await prisma.user.update({
diff --git a/packages/trpc/server/profile-router/router.ts b/packages/trpc/server/profile-router/router.ts
index 76e50473d..1ca8a0cf2 100644
--- a/packages/trpc/server/profile-router/router.ts
+++ b/packages/trpc/server/profile-router/router.ts
@@ -40,13 +40,16 @@ export const profileRouter = router({
password,
});
} catch (err) {
- const errorMessage = (err as { message?: string }).message;
+ let message =
+ 'We were unable to update your profile. Please review the information you provided and try again.';
+
+ if (err instanceof Error) {
+ message = err.message;
+ }
throw new TRPCError({
code: 'BAD_REQUEST',
- message: errorMessage
- ? errorMessage
- : 'We were unable to update your profile. Please review the information you provided and try again.',
+ message,
});
}
}),