move login-factory logic to user-factory