Add integration tests and fix some bugs found via testing

Here are a few more integration tests for the remaining scenarios that aren't currently covered (logins, claims, 2FA, phone number storage, lockouts, password storage).  It also fixes a couple bugs that the tests uncovered.