I note that you are saving passwords in plain text. You should, for data protection purposes, as a minimum, be hashing the password. There are several extensions available to do this.
I quite like this one:
or there is this:
If you wanted, you could hash both the user name and the password, then your spreadsheet could be set with Anyone with the link, and you could use gviz to read usernames and passwords, and then web component to update them.
Regarding your script, if you had it working before you added "forgot password", it should be easy enough to backtrack in order to find your error.