Problem with Users -> Columns get mixed up

Im currently having another weird issue with the BackendlessUser class.

After downloading a user it has the string that in backendless is entered in the lastname field set for the middlename property.

So in backendless web interface there is a user ‘Ber’, with lastname ‘Lastname’, but the retrieved object looks like this:

objectId:‘E5D0F2A9-876F-E4FF-FF01-C8EF80318200’, properties:{
“___class” = Users;
“__meta” = “{“relationRemovalIds”:{},“selectedProperties”:[“lastLogin”,“firstname”,“userStatus”,“initials”,“created”,“middlename”,“groups”,“ownerId”,“userId”,“lastname”,“userToken”,“password”,“name”,”___class",“updated”,“objectId”,“email”],“relatedObjects”:{}}";
created = “2015-12-30 09:18:27 +0000”;
email = “b.xxxx@xxxx.xx”;
firstname = Ber;
groups = “<null>”;
initials = B;
lastLogin = “<null>”;
lastname = “<null>”;
middlename = Lastname;
name = “<null>”;
objectId = “E5D0F2A9-876F-E4FF-FF01-C8EF80318200”;
ownerId = “<null>”;
password = “<null>”;
updated = “2016-01-19 13:27:31 +0000”;
userId = “E5D0F2A9-876F-E4FF-FF01-C8EF80318200”;
userStatus = ENABLED;
userToken = “<null>”;
}

It is getting worse: I cannot login anymore (user credentials are correct):

Login Error: 3003 Invalid login or password Invalid login or password

Hi Barry!
Just to clarify:

  1. “After downloading a user…” - it means “update user”, “create user”, “find user”…?
  2. Please provide your expected result.
    Regards,
    Kate.

Here is the code (worked before):

    func createUsersForCommonGroups() {
        print ("\nCurrent User: \(backendless.userService.currentUser.email)\n")
        
        // Create relation query for fetching the users relations
        let query = BackendlessDataQuery()
        
        // Where clause - find the all users having part in the groups with currentUser
        query.whereClause = "groups.users.email = '\(backendless.userService.currentUser.email)'"
        
        let dataStore = backendless.data.of(BackendlessUser.ofClass())
        dataStore.find(
            query,
            response: {(bc : BackendlessCollection!) -> () in
                
                // Import Users
                let users = bc.getCurrentPage() as! [BackendlessUser]
                importUsers(users)
                
                // Import groups
                self.importGroups()
                
                // Reindex projectObject owners
                self.cdHelper.reindexProjectObjectOwners()
            },
            error: { (fault : Fault!) -> () in
                print("Server reported an error (ASYNC): \(fault)")
        })
    }
    
    func importUsers(users:[BackendlessUser]) {
        
        for user in users {
            importUser(user)
        }
    }
    
    // Create/Update all users
    createUsersForCommonGroups()
}

private func importUser(user:BackendlessUser) {
    
    let backendID   = user.objectId
    let firstname   = user.getProperty("firstname") as! String
    print ("firstname: \(firstname)")
    print ("user: \(user)")
    let lastname    = user.getProperty("lastname") as! String
    let initials    = user.getProperty("initials") as! String
    let middlename  = user.getProperty("middlename") as? String
    let email = user.email
    
    print("Import User: \(email)")
    
    // Create or Update the user
    cdHelper.createUser(backendID, email:email, firstname: firstname, middlename: middlename, lastname: lastname, initials: initials)
    
    // save core data
    cdHelper.save()
}

Please provide your application id.