高章伟
2022-02-24 6b3c24ace33d131f5f6b10ae429d03c0d36db6f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * An apex page controller that exposes the site forgot password functionality
 */
public with sharing class ForgotPasswordController {
    public String username {get; set;}   
       
    public ForgotPasswordController() {}
    
      public PageReference forgotPassword() {
          boolean success = Site.forgotPassword(username);
          PageReference pr = Page.ForgotPasswordConfirm;
          pr.setRedirect(true);
          
          if (success) {              
              return pr;
          }
          return null;
      }
}