added login/logout logic to controller