refactor login manager and login box