Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Registration{
- private static string PORTAL_ACCOUNT_ID = '0019000001dNRMn';
- public blob imagebody{get;set;}
- public string firstname{get;set;}
- public string lastname{get;set;}
- public string email{get;set;}
- public string username{get;set;}
- public string password{get;set;}
- public string confirmpassword{get;set;}
- private boolean isValidPassword() {
- return password == confirmPassword;
- }
- public Registration(){
- }
- public void rigist(){
- if (!isValidPassword()) {
- ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,
- Label.site.passwords_dont_match);
- ApexPages.addMessage(msg);
- // return null;
- }
- User u = new User();
- u.Username = username;
- u.Email = email;
- // u.CommunityNickname = communityNickname;
- String accountId = PORTAL_ACCOUNT_ID;
- String userId = Site.createportaluser(u, accountId, password);
- if(userId != null) {
- if (password != null && password.length() > 1) {
- // return Site.login(username, password, null);
- }
- else {
- PageReference page = System.Page.SiteRegisterConfirm;
- page.setRedirect(true);
- // return page;
- }
- }
- // return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement