small refactor login/logout