refactor base.php: remove duplication
remove unused password form code
refactor base.php: further reduce duplication