Skip to content

Commit 93d568f

Browse files
authored
fix(ui): Prevent reset password submission if passwords don't match (#7432)
1 parent fce2ac5 commit 93d568f

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

.changeset/busy-snakes-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix issue where the reset password form could be submitted via the enter key even when the confirmation password didn't match.

packages/ui/src/components/SessionTasks/tasks/TaskResetPassword/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const TaskResetPasswordInternal = () => {
7575

7676
const resetPassword = () => {
7777
return card.runAsync(async () => {
78-
if (!clerk.user) {
78+
if (!canSubmit || !clerk.user) {
7979
return;
8080
}
8181

packages/ui/src/components/SignIn/ResetPassword.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ const ResetPasswordInternal = () => {
7171
};
7272

7373
const resetPassword = async () => {
74+
if (!canSubmit) {
75+
return;
76+
}
77+
7478
passwordField.clearFeedback();
7579
confirmField.clearFeedback();
7680
try {

packages/ui/src/components/UserProfile/PasswordForm.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ export const PasswordForm = withCardStateProvider((props: PasswordFormProps) =>
108108
};
109109

110110
const updatePassword = async () => {
111+
if (!canSubmit) {
112+
return;
113+
}
114+
111115
try {
112116
successPagePropsRef.current = {
113117
title: user.passwordEnabled

0 commit comments

Comments
 (0)