I know this is probably just a question of not understanding the documentation, but when registering a user, my password confirmation redirects to the apology, "both passwords must match". Following are the lines of code I'm using for the password and the confirmation:

 # ensure password was submitted
        elif not request.form.get("password"):
            return apology("must provide password")

        # ensure password is confirmed
        elif not request.form.get("password2") == "password":
            return apology("both passwords need to match to confirm")

The apology I get is "both passwords need to match to confirm". And, yes, I am entering the same password.

1 Answer 1


As long as password2 is "password" (literally), this will work. Are you sure you want to compare request.form.get("password2") to the string literal "password"

  • No, that isn't what I want to do. I tried assigning to a variable, but that didn't work either. Oh, and now I'm being told it's invalid syntax.
    – KitSeason
    Jul 31, 2017 at 23:37
  • Have you tried comparing request.form.get("password2") and request.form.get("password")? Aug 1, 2017 at 1:46
  • I ended up assigning to variables and then comparing the variables. That worked.
    – KitSeason
    Aug 3, 2017 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .