Tuesday, October 28, 2014

Change password site.com in SFDC

Following Apex Page...

<apex:page id="changePassword" showHeader="false" controller="ChangePasswordController" title="{!$Label.site.change_password}">
  <apex:composition template="{!$Site.Template}">
    <apex:define name="body">
      <center>
        <apex:panelGrid bgcolor="white" columns="1">
          <br/>
          <br/>
          <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="1" styleClass="topPanelContainer">
            <br/>
            <apex:outputPanel layout="block" styleClass="topPanel">
              <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="2">
                <apex:image url="{!URLFOR($Resource.SiteSamples, 'img/clock.png')}"/>
                <apex:panelGroup >
                  <br/>
                  <apex:outputText styleClass="title" value="{!$Label.site.change_your_password}"/>
                  <br/>
                  <apex:form id="theForm">
                    <apex:pageMessages id="error"/>
                    <apex:panelGrid columns="2" style="margin-top:1em;">
                      <apex:outputLabel rendered="{! !$Site.IsPasswordExpired}" value="{!$Label.site.old_password}" for="oldpsw"/>
                      <apex:inputSecret required="true" id="oldpsw" rendered="{! !$Site.IsPasswordExpired}" value="{!oldPassword}"/>
                      <apex:outputLabel value="{!$Label.site.new_password}" for="psw"/>
                      <apex:inputSecret required="true" id="psw" value="{!newPassword}"/>
                      <apex:outputLabel value="{!$Label.site.verify_new_password}" for="vpsw"/>
                      <apex:inputSecret required="true" id="vpsw" value="{!verifyNewPassword}"/>
                      <apex:outputText value=""/>
                      <apex:commandButton id="cpwbtn" action="{!changePassword}" value="{!$Label.site.change_password}"/>
                    </apex:panelGrid>
                  </apex:form>                
                  <br/>
                </apex:panelGroup>
              </apex:panelGrid>
             </apex:outputPanel>
            <c:SiteFooter />
          </apex:panelGrid>
       </apex:panelGrid>
      </center>
      <br/>
    </apex:define>
  </apex:composition>
</apex:page>



Apex Controller.....
/**
 * An apex page controller that exposes the change password functionality
 */
public with sharing class ChangePasswordController {
    public String oldPassword {get; set;}
    public String newPassword {get; set;}
    public String verifyNewPassword {get; set;}      
 
    public PageReference changePassword() {
        return Site.changePassword(newPassword, verifyNewPassword, oldpassword);  
    }  
 
    public ChangePasswordController() {}
}

7 comments:

  1. Can I create dynamic objects? Means Need to create an object with fields in run time.Is that possible?
    Regards,
    Salesforce training in Chennnai

    ReplyDelete
  2. es we can also do that by using Schema.sobject functionality of Salesforce it is a good one provided by Salesforce. We have a another option Write in Dynamic APEX class we create it.
    Regards,
    SAikumar.

    ReplyDelete
  3. Salesforce is the cloud based tool which is used by most of the professional who do CRM. Salesforce is the cost effective tool.
    salesforce training in chennai|salesforce training institute in chennai|salesforce training institutes in chennai|salesforce course in chennai

    ReplyDelete
  4. What i really like about salesforce is its user friendly UI and it is a cloud based tool so it can be accessed from any where. Also there is a mobile app and the features are such that any sales rep would fall for it.
    salesforce training chennai||best salesforce training in chennai||salesforce developer training

    ReplyDelete
  5. @Raghu Shrma,

    If you want develop School Management custom Please go through following link https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B3UdCEAV it is app exchange product if you haven't get any clear idea send me your requirement i will give a guidance.

    Regards,
    Sai.A.

    ReplyDelete
  6. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.
    Best Java Training Institute Chennai

    Java Training Institute Bangalore

    ReplyDelete
  7. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.
    mean-stack-training-institute-in-chennai

    ReplyDelete