added login&logout functionality. Fixed unit tests