PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/src/classes/SiteLoginController.cls

https://github.com/bmedagoda/Test-Org
Visual Basic | 23 lines | 19 code | 4 blank | 0 comment | 0 complexity | 38f02f91362116fcf039f64e3af0e8cd MD5 | raw file
  1. /**
  2. * An apex page controller that exposes the site login functionality
  3. */
  4. global with sharing class SiteLoginController {
  5. global String username {get; set;}
  6. global String password {get; set;}
  7. global PageReference login() {
  8. String startUrl = System.currentPageReference().getParameters().get('startURL');
  9. return Site.login(username, password, startUrl);
  10. }
  11. global SiteLoginController () {}
  12. global static testMethod void testSiteLoginController () {
  13. // Instantiate a new controller with all parameters in the page
  14. SiteLoginController controller = new SiteLoginController ();
  15. controller.username = 'test@salesforce.com';
  16. controller.password = '123456';
  17. System.assertEquals(controller.login(),null);
  18. }
  19. }