Login Controller

This is the loggin controller. This is as complicated as the controller looks.