Update controller.py

Moved login into request function