Added logout view, loginprotected the other views.

Updated the tests to cover all aspects of logging in.