move login related code in its own package