Changes to login infrastructure

Got login and user working for the most part. Still needs work though.