Made ldap auth work better with existing users migrated to ldap.
Updated model.php to use db insert/update/delete methods