5

I have logout url in my salesforce communities header url.I want to redirect to my custom login page of my communities.Currently its redirecting to standard salesforce login page.

<apex:page title="{!$Label.site.site_login}" showHeader="false" sidebar="false" standardStylesheets="false">

    <html lang="en">
    <head></head>
    <body>
        <nav class="navbar navbar-static-top navbar-inverse" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>
                <div class="collapse navbar-collapse navbar-ex1-collapse" id="tabs">
                    <ul class="nav navbar-nav">
                        <li id="Home">
                            <apex:outputLink value="{!$Page.Home}">Home</apex:outputLink>
                        </li>
                        <li id="chatter">
                            <apex:outputLink value="{!$Page.Chatter}">Chatter</apex:outputLink>
                        </li>
                        <li id="events">
                            <apex:outputLink value="{!$Page.Events}">Events</apex:outputLink>
                        </li>
                        <li id="answers">
                            <apex:outputLink value="{!$Page.Answers}">Answers</apex:outputLink>
                        </li>
                        <li id="logout">
                            <apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp">Log Out</apex:outputLink>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </body>
    </html>
</apex:page>

3 Answers 3

7

I created my own log out page and add the following visualforce code.

The code loads the branded logout page hidden in the background for 5 seconds before being redirected to the login page.

<apex:page showHeader="false" sidebar="false">
  <apex:iframe src="{!$Site.Prefix}/secur/logout.jsp" height="1" width="1" />
  <script>
    function redirectToLogin(){
      window.parent.location="{!$Site.Prefix}";
    }   
    setTimeout("redirectToLogin()", 500);
  </script>
  Logging out...
</apex:page>
1
  • Awesome. That worked! Thank you so much for posting it. Aug 12, 2014 at 18:11
1

You can build your own logout page and load the Salesforce logout page within a hidden iframe on that page.

<!-- Log out of the community -->
<iframe style="height:0px;overflow:hidden;" src="/secur/logout.jsp" />

<!-- Redirect with or without delay -->
<script>
    jQuery(document).ready( function() {
        setTimeout(function(){ 
            document.location = {!BLANKVALUE($CurrentPage.Parameters.retURL,'CUSTOM URL HERE')}";
        }, 
        {!BLANKVALUE($CurrentPage.Parameters.delay, '4500')} ); 
    });
</script>
0

As of the Winter '15 release, you can set a custom logout page URL under
Administration Settings > Login & Registration.

Check out the documentation here:
http://docs.releasenotes.salesforce.com/en-us/winter15/release-notes/rn_networks_custom_pages.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .