Adding a login method to the controller