function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sakhisakhi 

unexpected Error:Old password is invalid while using site.changepassword()

Hi , I have a requirement to design and implement login,forget password and reset password functionality of salesforce. I have 3 standalone visual force pages for the same using same controller. I am able to implement login and forget password sucessfully but facing problem in reset password due to unexpected error bugging me . From forget password page I get system generated password via email. Using that password when user tries to login from login page ,user is redirected to my reset password page. There password changes as When I login from login page from newly changed password It goes fine , But My problem is In reset password page always when i hit save error pops up saying Error:Old password is invalid. Please find my code below and help me where I went wrong . /***********changepassword method to be called on click of save button of reset password page************/ global PageReference changePassword(){ return Site.changePassword(newpassword, verifypassword, Oldpassword); } /************** method to be called on click of submit from the forgot password page**************/ global Boolean forgotPassword(){ return Site.forgotPassword(useridlabel); } global PageReference login() { String startUrl = System.currentPageReference().getParameters().get('​startURL'); if (startUrl == null){ startUrl = '/home/home.jsp'; } system.debug('*****username and Password****'+ username+'****'+password); system.debug('****starturl is ***' + startUrl); system.debug('Site.login' + Site.login(username, password, startUrl)); return Site.login(username, password, startUrl); } Please help me out on this.....