Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public class Registration{
  2. private static string PORTAL_ACCOUNT_ID = '0019000001dNRMn';
  3. public blob imagebody{get;set;}
  4. public string firstname{get;set;}
  5. public string lastname{get;set;}
  6. public string email{get;set;}
  7. public string username{get;set;}
  8. public string password{get;set;}
  9. public string confirmpassword{get;set;}
  10. private boolean isValidPassword() {
  11. return password == confirmPassword;
  12. }
  13.  
  14. public Registration(){
  15. }
  16.  
  17. public void rigist(){
  18.  
  19. if (!isValidPassword()) {
  20. ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,
  21. Label.site.passwords_dont_match);
  22. ApexPages.addMessage(msg);
  23. // return null;
  24. }
  25.  
  26. User u = new User();
  27. u.Username = username;
  28. u.Email = email;
  29. // u.CommunityNickname = communityNickname;
  30.  
  31. String accountId = PORTAL_ACCOUNT_ID;
  32. String userId = Site.createportaluser(u, accountId, password);
  33. if(userId != null) {
  34.  
  35. if (password != null && password.length() > 1) {
  36. // return Site.login(username, password, null);
  37. }
  38. else {
  39. PageReference page = System.Page.SiteRegisterConfirm;
  40. page.setRedirect(true);
  41. // return page;
  42. }
  43. }
  44. // return null;
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement