Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. /**
  2. * An apex page controller that exposes the site login functionality
  3. */
  4. global with sharing class CommunitiesLoginController {
  5.  
  6. global CommunitiesLoginController () {}
  7.  
  8. // Code we will invoke on page load.
  9. global PageReference forwardToAuthPage() {
  10. String startUrl = System.currentPageReference().getParameters().get('startURL');
  11. String displayType = System.currentPageReference().getParameters().get('display');
  12. return Network.forwardToAuthPage(startUrl, displayType);
  13. }
  14. // Code we will invoke on page load.
  15. global PageReference forwardToCustomAuthPage() {
  16. return new PageReference('/CustomLoginPage');
  17. }
  18. }
  19.  
  20. /**
  21. * An apex page controller that exposes the site login functionality
  22. */
  23. @IsTest global with sharing class CommunitiesLoginControllerTest {
  24. @IsTest(SeeAllData=true)
  25. global static void testCommunitiesLoginController () {
  26. CommunitiesLoginController controller = new CommunitiesLoginController();
  27. System.assertEquals(null, controller.forwardToAuthPage());
  28. PageReference p = new PageReference ('/CustomLoginPage');
  29. System.assertEquals( p, controller.forwardToCustomAuthPage());
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement