update login controller to use api and check credentials on backend