Complete login states are catered for

All login states are catered for, testing to be written
Allows us to use sessioncache standalone
Fix redirect loop bug