You need to sign in to do that
Don't have an account?
SFDCmack08180939826349907
Trying to build a code that uses system.resetpassword () method to overwrite the default community password reset Since it is not working due to Winter 16
The code appears to be working from the debug logs and resetting the password internally by clicking on the view button in Visualforce. I am not sure what I am missing:
* An apex page controller that exposes the site forgot password functionality
*/
Global class ForgotPasswordController {
Global String username {get; set;}
Global ForgotPasswordController() {}
Global PageReference forgotPassword() {
User usr = [select Id from User where username=:username];
system.debug(usr);
boolean success = Site.forgotPassword(username);
PageReference pr = Page.ForgotPasswordConfirm;
pr.setRedirect(true);
if (success) {
system.resetPassword(usr.Id,True);
return pr;
}
return null;
}
Global static testMethod void testForgotPasswordController() {
// Instantiate a new controller with all parameters in the page
ForgotPasswordController controller = new ForgotPasswordController();
controller.username = 'test@salesforce.com';
System.assertEquals(controller.forgotPassword(),null);
}
}
When you go to communities and conduct a password reset outside it does not work why?
* An apex page controller that exposes the site forgot password functionality
*/
Global class ForgotPasswordController {
Global String username {get; set;}
Global ForgotPasswordController() {}
Global PageReference forgotPassword() {
User usr = [select Id from User where username=:username];
system.debug(usr);
boolean success = Site.forgotPassword(username);
PageReference pr = Page.ForgotPasswordConfirm;
pr.setRedirect(true);
if (success) {
system.resetPassword(usr.Id,True);
return pr;
}
return null;
}
Global static testMethod void testForgotPasswordController() {
// Instantiate a new controller with all parameters in the page
ForgotPasswordController controller = new ForgotPasswordController();
controller.username = 'test@salesforce.com';
System.assertEquals(controller.forgotPassword(),null);
}
}
When you go to communities and conduct a password reset outside it does not work why?
SFDCmack08180939826349907