Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added pass confirm to pass reset page #332

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/client/components/auth/src/flows/FlowConfirmReset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ export default function FlowConfirmReset() {
*/
async function reset(data: FormData) {
const password = data.get("new-password") as string;
const confirmPassword = data.get("confirm-password") as string;
const remove_sessions = !!(data.get("log-out") as "on" | undefined);

// Check if passwords match
if (password !== confirmPassword) {
alert("Passwords do not match. Please try again.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not appropriate for sending errors to users, it should be displayed in the UI directly.

return;
}

// If passwords match, submit the form
await clientController.api.patch("/auth/account/reset_password", {
password,
token,
Expand All @@ -35,7 +43,7 @@ export default function FlowConfirmReset() {
<>
<FlowTitle>{t("login.reset")}</FlowTitle>
<Form onSubmit={reset}>
<Fields fields={["new-password", "log-out"]} />
<Fields fields={["new-password", "confirm-password", "log-out"]} />
<Button type="submit">{t("login.reset")}</Button>
</Form>
<Typography variant="legacy-settings-description">
Expand All @@ -44,3 +52,4 @@ export default function FlowConfirmReset() {
</>
);
}

Loading