Change password without requiring the old password returns "incorrect password error"

What I’m trying to do:
I have an app that originally only allowed login thru the Google API. I’m now allowing users to create and reset internal passwords (using Anvil’s own features).

What I’ve tried and what’s not working:
For old users (that used Google Account to login) I have a button that triggers the option to reset their password. I’m using the following code:

from anvil import users

users.change_password_with_form(require_old_password=False)

I’m passing require_old_passwords=False because the users don’t have passwords yet. When I run the above code the popup asking for a new password and it’s confirmation successfully appears, but when you type the password, a message saying “Incorrect password” appears. It appears to be an issue with not passing the old password… but I don’t really want to pass it. And users can only see this option if they are logged-in.

This was reported as a bug back in 2020: Bug in password change form?

Obviously it hasn’t been fixed yet.

As a workaround, if the users click the Forgot Password link on the login dialog they’ll be able to set a password even if they don’t have one yet.

3 Likes