Due UIA it is valid for a client to sit hitting the endpoint repeatedly (if e.g. waiting for the user to click a link in an email). Currently, if the request includes the new password then we'll hash it each and every time we the request, which is expensive.
Instead, we only calculate and store the password hash if we haven't done it previously. When the request finally succeeds and includes password again, we will still hash and use that.
Due UIA it is valid for a client to sit hitting the endpoint repeatedly (if e.g. waiting for the user to click a link in an email). Currently, if the request includes the new password then we'll hash it each and every time we the request, which is expensive.
Instead, we only calculate and store the password hash if we haven't done it previously. When the request finally succeeds and includes password again, we will still hash and use that.
Reviewable commit-by-commit.
The first commit is simply a refactor.