Search code examples
swiftquickblox

In Quickblox is it possible to update the user password without reset?


I am attempting to change a user's password with the following code:

        let updateParameters = QBUpdateUserParameters()
        updateParameters.password = newPasswordField.text
        QBRequest.updateCurrentUser(updateParameters, successBlock: { (response: QBResponse, user: QBUUser?) -> Void in
            print("success")
            }, errorBlock: { (response: QBResponse) -> Void in
                print("error")
        })

Upon debugging, I receive a 422 client error. I am assuming this is because QBUpdateUserParameters has a restriction on updating passwords.

I ran into a couple of answers where you could change the password with the old QBUUsers class but recent updates seemed to have removed the use of this class. Can someone point me in the right direction?


Solution

  • You also need to provide your old password:

     updateParameters.oldPassword = ...