我正在使用此代码更新用户密码:
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];
}];
但是,我收到一条错误消息:“提供的密码不正确。”旧密码肯定是正确的,因为我使用它来登录会话。每次尝试时,新密码的长度至少为8个字符。为什么我不能更新用户的密码?
感谢。
答案 0 :(得分:1)
您使用的是什么SDK版本?
这是对版本2.0.6 http://quickblox.com/developers/IOS#Framework_changelog中的2.x API的修复:
如果您使用的是较新版本 - 可以发布此请求的Xcode日志
答案 1 :(得分:0)
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))
}
})