Knowledgebase
Is it possible to change user’s password after login?
Posted by on 13 January 2014 02:53 PM

Is it possible to change user’s password after login?

Yes, there is actually a possibility to change password after user has logged in.

You can use the following for iOS:

QBUUser *user = [QBUUser user];
user.ID = 300;
user.oldPassword = @"fgrhpass";
user.password = @"newpassword";

[QBUsers updateUser:user delegate:self];

And for Android this can be done the following way:

Snippet updateUser = new Snippet("update user") {
        @Override
        public void execute() {
            final QBUser user = new QBUser();
            user.setId(53779);
           user.setPassword("newPassword");
            user.setOldPassword("oldPassword");

            QBUsers.updateUser(user, new QBCallbackImpl() {
                @Override
                public void onComplete(Result result) {
                    if (result.isSuccess()) {
                        QBUserResult qbUserResult = (QBUserResult) result;

                        Log.i(TAG, ">>> updatedAt: " + qbUserResult.getUser().getUpdatedAt());
                        Log.i(TAG, ">>> createdAt: " + qbUserResult.getUser().getCreatedAt());

                        Log.i(TAG, ">>> User: " + qbUserResult.getUser().toString());
                    } else {
                        handleErrors(result);
                    }
                }
            });
        }
    };

(7 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: