mirror of
https://github.com/documenso/documenso.git
synced 2025-11-11 04:52:41 +10:00
fix: minor tidying
This commit is contained in:
@ -76,7 +76,7 @@ export const PasswordForm = ({ className }: PasswordFormProps) => {
|
|||||||
title: 'An unknown error occurred',
|
title: 'An unknown error occurred',
|
||||||
variant: 'destructive',
|
variant: 'destructive',
|
||||||
description:
|
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.',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export const updatePassword = async ({ userId, password }: UpdatePasswordOptions
|
|||||||
const isSamePassword = await compare(password, user.password as string);
|
const isSamePassword = await compare(password, user.password as string);
|
||||||
|
|
||||||
if (isSamePassword) {
|
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({
|
const updatedUser = await prisma.user.update({
|
||||||
|
|||||||
@ -40,13 +40,16 @@ export const profileRouter = router({
|
|||||||
password,
|
password,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} 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({
|
throw new TRPCError({
|
||||||
code: 'BAD_REQUEST',
|
code: 'BAD_REQUEST',
|
||||||
message: errorMessage
|
message,
|
||||||
? errorMessage
|
|
||||||
: 'We were unable to update your profile. Please review the information you provided and try again.',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user