add login functionality to controller