Updating User object effectively disables login

I have a simple view controller with a form that allows users to update some of their account info. When I update the user object with new property values and save those changes to Backendless, the user is no longer able to log in. The behavior is the same whether or not the user’s password is included as one of the properties to update. The only way to allow the user to log in again is to manually enter a password into the Backendless console.

The user.update call reports success every time.

My User object is defined with “mobileNumber” as the identity property and “name” as required.

if let user = Backendless.sharedInstance().userService.currentUser {

	var properties = [String: AnyObject]()




	if userNameField.text != nil {

		properties["name"] = userNameField.text!

	}

	if emailField.text != nil {

		properties["email"] = emailField.text!

	}

	if passwordField.text != nil {

		properties["password"] = passwordField.text!

	}




	user.update(propertiesToUpdate: properties) { (success, fault) -> () in

		if success {

			print("success")

		}

	}

}

The login API uses only the property marked as “identity” and the password. If these two do not change, the login should not be impacted. When you say a user cannot login, what error do you get?

I just tested again and changed only the user’s email address in my form. I can see that the updated email address now appears in the console. However, I can no longer log in as that user. I get the following response from the server:

Invalid login or password

What does the “userStatus” column show for the user in Backendless console?

Which column is marked as identity? (you can see it in the Users > User Properties screen).

userStatus is “ENABLED”. That did not change, even after the email address was updated. In other words, it was still “ENABLED” when I could not log in.

The Users table has only 4 properties: password, name, mobileNumber, and email. password, name, and mobileNumber are marked as “required”. Additionally, mobileNumber is marked as “Identity”.

Do you use the value from the mobileNumber column in the login API? If you do, I suspect the password is not entered correctly. You could try resetting the password in console, or initiating password change via API:

https://backendless.com/documentation/users/ios/users_password_recovery.htm

The test user’s password is “password”. I’m sure it is entered correctly in my login form. I can log in with that password before the account update. Following the account update (again, only changing email address), I can’t login with “password”. After receiving the failure message from the server, I manually enter “password” into the console, and simply tap the Login button again in my app’s login form (without changing either the mobileNumber or password values in the form) and the server returns a success response.

It sure seems like something in the account update process is resetting or invalidating the user’s password, even though that value is not included in my list of properties to change as part of the account update.

Hi Brad,

Please, update the latest backendless SDK release (3.0.10) from CocoaPods or github.
Then check your app again and let we know how it goes.

Regards,
Slava

Unfortunately your code is not be used for reproducing this issue.

Could you download your whole project (or some sample demonstrating the problem) to Dropbox or Google Drive, and send the link to support@backendless.com?