You need to sign in to do that
Don't have an account?
Rony57
send password link on self registeration
I have made a controller of self user registration . and while doing this what i am trying to make is that when ever user registered a password link should be sent on user email id ,just like when ever we create a org and sales force send a email verification link on our email id. Is it possible to do so? If yes then How? Help me out Guys.!! Here is a Controller:-
public with sharing class CommunitiesSelfRegController { public String firstName {get; set;} public String lastName {get; set;} public String email {get; set;} public String password {get; set {password = value == null ? value : value.trim(); } } public String confirmPassword {get; set { confirmPassword = value == null ? value : value.trim(); } } public String communityNickname {get; set { communityNickname = value == null ? value : value.trim(); } } public String CompanyName { get; set; } public String fPhone { get; set; } public CommunitiesSelfRegController() {} private boolean isValidPassword() { return password == confirmPassword; } public PageReference registerUser() { // it's okay if password is null - we'll send the user a random password in that case if (!isValidPassword()) { ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, Label.site.passwords_dont_match); ApexPages.addMessage(msg); return null; } String profileId = '00e90000001jxLE'; // To be filled in by customer. String roleEnum = 'Partner User'; // To be filled in by customer. String accountId = ''; // To be filled in by customer. String CityOffice='00590000003BnUR'; String StateOffice='00590000003BnSa'; String Owner='00590000003Bn3L'; // sytem Admin ID String AccountNumber; Account account= new Account(); account.Name =firstName; account.SPBE__First_Name__c= firstName; account.SPBE__Last_Name__c = lastName; account.SPBE__Email__c=email; insert account; account.OwnerId=Owner; // account.isPartner=true; update account; AccountNumber=account.Account_Number__c; accountId = account.Id; String userName = email; User u = new User(); u.Username = userName; u.Email = email; u.FirstName = firstName; u.LastName = lastName; u.CommunityNickname = firstName+AccountNumber; u.CompanyName=CompanyName; u.Phone=fPhone; u.SPBE__City_Office__c=CityOffice; u.SPBE__State_Office__c=StateOffice; u.ProfileId = profileId; String userId = Site.createPortalUser(u, accountId, password); if (userId != null) { if (password != null && password.length() > 1) { return Site.login(userName, password, ApexPages.currentPage().getParameters().get('startURL')); } else { PageReference page = System.Page.CommunitiesSelfRegConfirm; page.setRedirect(true); return page; } } return null; }
{!Community_Url}
Customize>Communities >All Communities
You will find small drop down button near your community name . click on administration settings a pop will open and there you will find your email template and make sure send welcome email check box is checked.