Fixed some code, it compiles but login and logout are untested.