function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bozotheclownbozotheclown 

Issue with Custom Login Page Creation

Hello.  I am trying to develop a custom login page - right now for just my sandbox environment.  The goal of this would be that I would see my corporate logo during signon instead of the standard salesforce.com login page.

 

I have developed the page - all looks fine.    Unfortunately, after typing the address, I am still being prompted with the standard Salesforce.com login page - only after logging in does it take me to my custom login page.

 

I know I am likely missing a pretty fundamental step - but I am confused as to the next best way to get this working.

 

Thanks in advance.

EIE50EIE50

Hi,

 

Can you post your page?

 

Thanks.

bozotheclownbozotheclown

Sure. 

 

Since I am just getting started with creating the page, I initially tried the sample code that was included upon creating my force.com account (in other words, the VF and controller code that was provided by salesforce.com).

 

I simply copied the VF code into a different page...and added the reference to the "SiteLoginController".  That is all I did.

 

I question whether the problem is the code itself.  I did not know if the sandbox is triggering the standard force.com login page to initially appear...or if there was some other command I should use to let the system know that this was an authentic login page.

 

I appreciate the help.

 

 

<apex:page controller="SiteLoginController" id="loginPage" showHeader="false" title="{!$Label.site.site_login}">
  <apex:composition template="{!$Site.Template}">
    <apex:define name="body">  
      <center>
        <apex:panelGrid bgcolor="white" columns="1" style="align: center;"> 
          <br/>
          <br/>
          <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="1" style="text-align:left; border:1px solid #ccc;"> 
            <br/>
            <apex:outputPanel layout="block" style="background-color: white; border: 1px solid #ccc; padding: 0px; margin-top: 10px; margin-bottom: 0px; margin-left: 10px; margin-right: 10px;">
              <apex:panelGrid width="758" cellpadding="0" cellspacing="0" bgcolor="white" columns="2"> 
                <apex:image url="{!$Site.Prefix}{!$Label.site.img_path}/clock.png"/>
                <apex:panelGroup >
                  <br/>
                  <apex:outputText style="font-size: larger; font-weight: bold;" value="{!$Label.site.login}"/>
                  <br/>
                  <c:SiteLogin id="siteLogin"/>
                  <br/>
                </apex:panelGroup>
              </apex:panelGrid> 
             </apex:outputPanel>
            <c:SiteFooter />
          </apex:panelGrid> 
       </apex:panelGrid>
      </center>
      <br/>
    </apex:define>
  </apex:composition>
</apex:page>


************************************

CONTROLLER

/**
 * An apex page controller that exposes the site login functionality
 */
public class SiteLoginController {
    public String username {get; set;}
    public String password {get; set;}

    public PageReference login() {
        String startUrl = System.currentPageReference().getParameters().get('startURL');
        return Site.login(username, password, startUrl);
    }
    
    public SiteLoginController () {}
    
    public static testMethod void testSiteLoginController () {
        // Instantiate a new controller with all parameters in the page
        SiteLoginController controller = new SiteLoginController ();
        controller.username = 'test@salesforce.com';
        controller.password = '123456'; 
                
        System.assertEquals(controller.login(),null);                           
    }    
}

 

EIE50EIE50

Hi,

 

Is this page for your force.com site or for your developer sandbox login? The controller and Vf page that you are using is  to log you in to the force.com site, right?

 

Thanks.

bozotheclownbozotheclown

Actually, this is intended to login to the sandbox environment.  The sample code was provided in the sandbox environment.

 

I appreciate the help with this...trying to get my arms around everything.

EIE50EIE50

Hi,

 

I dont think there is a straight forward way to do this, also i am not sure whether this route would work or not. Give it a try though.

 

1) First setup a force.com site with an visualforce page as your active home page. Do not use any controller in this page.

 

 

<apex:page title="Your Company Login">

</apex:page>

 

 

2) Go to https://test.salesforce.com/ and right click your mouse and view page source. Copy paste the required java script and html code in to your VF page created in step 1.

 

 

<apex:page title="your company login">
<head>
 
</head>
<body>
 your html code here
</body>
</apex:page>

 

 

3) edit the html code as per your requirement and give your own stylings.

 

If this works, then in futre all your users would not use test.salesforce.com to login to the sandbox, instead they would use the site url that you created in step 1 in order to login to sandbox.

 

Give this a try and let me know.

 

Thanks.

bozotheclownbozotheclown

I appreciate the help.  I will definitely give this a try.  I am getting pulled into another project today...but will get on this next week and let you know.

 

Thanks again.

aDevaDev

Hi,

 

I need to develop a custom login page, I tried to copy,paste the script on VF page and didn't work.

 

I am new to Salesforce, any sample page is really appreciated.

 

Thank You.

VK86VK86

Hello EIE50,

 

Firstly, thank you for making this easy to understand for non-programmers.

Really appreciate if you could provide a sample code for the login page. 

 

Thanks,

VK

AcmiaAcmia

I have the same issue.

I did find that you can customize a little bit on the SiteLogin page by changing the login related components: SiteHeader, SiteFooter and SiteLogin ( see http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites). But, any direct changes to the default SiteLogin Page, would not show up; when you configure the site, there is no way to allow you to specify a new custom login page. 

 

Can Any salesforce.com guy point out a solution on this?  

Talata AyevaTalata Ayeva
Hello, I have a question and maybe you can help me. We are trying to customize our login page to add an email for the user to start email to case instead of calling the support desk. Everyday we have a batch that deactivates users with no activities past 30 days. For the reactivation, we would like the user to click on the email 2 case email address that will trigger his reactivation in Salesfore. Anyone has a suggestion on how to add the email just for this type of message?
Custom Login Page
Thank you.