joshg47
joshg47

Reputation: 135

Quickblox update user password fails with correct information

I am using this code to update a user's password:

    QBUUser *usertemp = [QBUUser user];
    usertemp.ID = [LocalStorageController shared].qbUser.ID;
    usertemp.oldPassword = [defaults objectForKey:@"password"];
    usertemp.password = self.passwordField.text;

    [QBRequest updateUser:usertemp successBlock:^(QBResponse *response, QBUUser *user) {
        // User updated successfully

    } errorBlock:^(QBResponse *response) {
        NSString *errorMessage = [[response.error description] stringByReplacingOccurrencesOfString:@"(" withString:@""];
        errorMessage = [errorMessage stringByReplacingOccurrencesOfString:@")" withString:@""];

        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Oops!"
                                                          message:errorMessage
                                                         delegate:nil
                                                cancelButtonTitle:@"Got it"
                                                otherButtonTitles: nil];

        [myAlertView show];
    }];

However, I am receiving an error: "Incorrect old password provided." The old password is definitely correct because I use it to log in to the session. The new password is at least 8 characters long every time I try. Why can't I update the user's password?

Thanks.

Upvotes: 1

Views: 918

Answers (2)

Rajesh Kumar
Rajesh Kumar

Reputation: 622

In JAVASCRIPT SDK 

1.   $(document).ready(function () {

    //alert(getCookie('UserPassword'))
    QB.init(QBApp.appId, QBApp.authKey, QBApp.authSecret);

    QB.createSession(function (err, result) {
        console.log('Session create callback', err, result);
    });


})

2.  var user = { 'login': Username, 'password': pwd };
   QB.login(user, function (err, response) {

        if (err) {
            alert(JSON.stringify(err.message))
        }
    });

3.  var params = { password: pwd,old_password:oldpassword};
  QB.users.update("THis is Quick BloxID '2356899'", params, function (err, response) {
       if (response) {
           alert("Your Password Changed!!")
       } else {

             alert(JSON.stringify(err))  
        }
    })

Upvotes: 0

Rubycon
Rubycon

Reputation: 18346

What SDK version do you use?

It was a fix for 2.x API in version 2.0.6 http://quickblox.com/developers/IOS#Framework_changelog:

If you use a newer version - can you post your Xcode log of this request

Upvotes: 1

Related Questions