tiangolo / full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐛 Error in frontend when resetting a password: "The passwords do not match"

tiangolo opened this issue · comments

Discussed in #1170

Originally posted by adnankaya April 15, 2024
Hi @tiangolo @alejsdev , there is an error on frontend I pointed in the following code. As a backend developer I only could find the problem and show it. Hopefully it helps frontend devs to fix it.

First Check

  • I added a very descriptive title here.
  • I used the GitHub search to find a similar question and didn't find it.
  • I searched in the documentation/README.
  • I already searched in Google "How to do X" and didn't find any information.
  • I already read and followed all the tutorial in the docs/README and didn't find an answer.

Commit to Help

  • I commit to help with one of those options 👆

Example Code

export const confirmPasswordRules = (
  getValues: () => any,
  isRequired = true,
) => {
  const rules: any = {
    validate: (value: string) => { 
      // qwert123
      console.log(value);
      /*
      {
        "new_password": "qwert123",
        "confirm_password": "qwert123"
      }
      */ 
      console.log(getValues());
      // getValues().password is None because as we can see above log message shows only object has new_password and confirm_password keys
      return value === getValues().password || "The passwords do not match"},
  }

  if (isRequired) {
    rules.required = "Password confirmation is required"
  }

  return rules
}

Description

Open browser -> Forgot Password -> Enter Email -> Continue -> Mail (password reset link) -> http://localhost/reset-password?token=eyJhbGciOiJI... -> Set Password (Entered qwert123) / Confirm Password (Entered qwert123)

The passwords do not match error appears above the Reset Password button.

Operating System

macOS

Operating System Details

Mac Os M2

Python Version

Python 3.10.14

Additional Context

No response

This was handled in #1171