Updated controller for login validation