[BUG] Fixes various bugs in user auth.

I made made the changes Jacob suggested. Let me know if there are any more changes that need to be made.