updated login method in database to get a User object from json