Moved login code from base.py to login.py