Monday, June 18, 2012

SharePoint 2010 FBA : Forms Login Page


login page location:

C:\inetpub\wwwroot\wss\VirtualDirectories\Portno\_forms\default.aspx

my Login page having 2 custom links like Forgot Password and Register page

Warning: this page is not encrypted for secure communication. User names, passwords, and any other information will be sent in clear text. For more information, contact your administrator. 


you can hide above error in the sign in page using below code

  if (document.location.protocol != 'https:' || document.location.protocol != 'http:')       
  SslWarning.style.display = 'none';



//hide Sign in heading 
BODY #s4-simple-card H1
 {
   display:none !important;
 }

login page location
C:\inetpub\wwwroot\wss\VirtualDirectories\Portno\_forms\default.aspx

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
    <SharePoint:EncodedLiteral runat="server" EncodeMethod="HtmlEncode" Id="ClaimsFormsPageTitle" />
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
    runat="server">
    <SharePoint:EncodedLiteral runat="server" EncodeMethod="HtmlEncode" Id="ClaimsFormsPageTitleInTitleArea" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSiteName" runat="server" />


//it will override default error icon
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderIcon" runat="server">
    <img title="pgclogo" border="0" alt="myLogo" src="/_layouts/images/logo.gif" />
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    <div id="SslWarning" style="color: red; display: none">
        <SharePoint:EncodedLiteral runat="server" EncodeMethod="HtmlEncode" Id="ClaimsFormsPageMessage" />
    </div>

    <script language="javascript">

      if (document.location.protocol != 'https:' || document.location.protocol != 'http:')
      {
            var SslWarning = document.getElementById('SslWarning');
            SslWarning.style.display = 'none';
      }
    </script>

    <asp:Login ID="signInControl" FailureText="<%$Resources:wss,login_pageFailureText%>"
        runat="server" Width="100%">
        <LayoutTemplate>
            <asp:Label ID="FailureText" class="ms-error" runat="server" />
            <table width="100%">
                <tr>
                    <td nowrap="nowrap">
                        <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,login_pageUserName%>"
                            EncodeMethod='HtmlEncode' />
                    </td>
                    <td width="100%">
                        <asp:TextBox ID="UserName" autocomplete="off" runat="server" class="ms-inputuserfield"
                            Width="99%" />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,login_pagePassword%>"
                            EncodeMethod='HtmlEncode' />
                    </td>
                    <td width="100%">
                        <asp:TextBox ID="password" TextMode="Password" autocomplete="off" runat="server"
                            class="ms-inputuserfield" Width="99%" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <asp:Button ID="login" CommandName="Login" Text="<%$Resources:wss,login_pagetitle%>"
                            runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:CheckBox ID="RememberMe" Text="<%$SPHtmlEncodedResources:wss,login_pageRememberMe%>"
                            runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        <asp:HyperLink ID="forgotpassword" runat="server" NavigateUrl="/_layouts/Extranet.ApplicationPages/Membership/forgotpassword.aspx">Forgot Password? &nbsp; </asp:HyperLink>
                        <asp:HyperLink ID="Register" runat="server" NavigateUrl="/_layouts/Extranet.ApplicationPages/Membership/register.aspx">Register here..</asp:HyperLink>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
    </asp:Login>
</asp:Content>


2 comments:

  1. Hi Surya,

    I have implemented the same code as you above mentioned, But i am facing an issue once i click on forgot password hyperlink then come on same login page not redirect to forgotpassword page. Can you help me out on the same ASAP. It will be great help.
    Thanks.
    Alok

    ReplyDelete
  2. Made my day, I'm testing on SharePoint 2016 I'll tell you if everything is working the same.

    ReplyDelete

Followers