Example SharePoint 2010 FBA Login Page


This is an example SharePoint 2010 claims based forms authentication login page. This has all the basic elements you would want, including password reset. Just update the placeholder MyCompany bits with your company information and enjoy! Remember if you include a login page within a solution it needs to go to IDENTITYMODEL\LOGIN and to update the web application properties for which login page to use. 🙂

<%@ Assembly Name=“Microsoft.SharePoint.IdentityModel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>

<%@ Assembly Name=“Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”%> <%@ Page Language=“C#” Inherits=“Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage” MasterPageFile=“~/_layouts/simple.master” %> <%@ Import Namespace=“Microsoft.SharePoint.WebControls” %> <%@ Register Tagprefix=“SharePoint” Namespace=“Microsoft.SharePoint.WebControls” Assembly=“Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %> <%@ Register Tagprefix=“Utilities” Namespace=“Microsoft.SharePoint.Utilities” Assembly=“Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %> <%@ Import Namespace=“Microsoft.SharePoint” %> <%@ Assembly Name=“Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>

<asp:Content ContentPlaceHolderId=”PlaceHolderPageTitle” runat=”server”>

<SharePoint:EncodedLiteral runat=”server” EncodeMethod=”HtmlEncode” Id=”ClaimsFormsPageTitle” />

</asp:Content>

<asp:Content ContentPlaceHolderId=”PlaceHolderPageTitleInTitleArea” runat=”server”>

<SharePoint:EncodedLiteral runat=”server”  EncodeMethod=”HtmlEncode” Id=”ClaimsFormsPageTitleInTitleArea” />

</asp:Content>

<asp:Content ContentPlaceHolderId=”PlaceHolderSiteName” runat=”server”/>

<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>

<div id=”SslWarning” style=”color:red;display:none”>

<SharePoint:EncodedLiteral runat=”server”  EncodeMethod=”HtmlEncode” Id=”ClaimsFormsPageMessage” />

</div>

<style>

BODY #s4-simple-card

{

margin: 25px auto 0px !important;

width: 900px !important;

}

BODY #s4-simple-content

{

margin-left:0px !important;

}

DIV.s4-simple-iconcont

{

display:none !important;

}

BODY #s4-simple-card H1

{

display:none !important;

}

</style>

<script language=javascript type=’text/javascript’>

function showHide()

{

if (document.getElementById(‘resetPass’).style.display == “none”)

{

document.getElementById(‘loginArea’).style.display = “none”;

document.getElementById(‘resetPass’).style.display = “”;

}

else

{

document.getElementById(‘loginArea’).style.display = “”;

document.getElementById(‘resetPass’).style.display = “none”;

}

}

</script>

<script language=”javascript” >

if (document.location.protocol != ‘https:’)

{

var SslWarning = document.getElementById(‘SslWarning’);

SslWarning.style.display = ”;

}

</script>

<div align=”center”>

<table width=”100%”><tr><td><img src=”MyCompanyBanner.png” alt=”MyCompany – Motto” /></td></tr><tr><td>

<div id=”loginArea” align=”center”>

<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=”80%”>

<tr>

<td nowrap=”nowrap” align=”right”><SharePoint:EncodedLiteral runat=”server” text=”<%$Resources:wss,login_pageUserName%>” EncodeMethod=’HtmlEncode’/></td>

<td width=”100%” align=”left”><asp:textbox id=”UserName” autocomplete=”off” runat=”server” class=”ms-inputuserfield” width=”99%” /></td>

</tr>

<tr>

<td nowrap=”nowrap” align=”right”><SharePoint:EncodedLiteral runat=”server” text=”<%$Resources:wss,login_pagePassword%>” EncodeMethod=’HtmlEncode’/></td>

<td width=”100%” align=”left”><asp:textbox id=”password” TextMode=”Password” autocomplete=”off” runat=”server” class=”ms-inputuserfield” width=”99%”/></td>

</tr>

<tr>

<td></td>

<td><b><a href=”javascript:showHide()”>Lost/Reset Password?</a></b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<asp:checkbox id=”RememberMe” text=”<%$SPHtmlEncodedResources:wss,login_pageRememberMe%>” runat=”server” /></td></td>

<td align=”right”><asp:button id=”login” commandname=”Login” text=”<%$Resources:wss,login_pagetitle%>” runat=”server” /></td>

</tr>

<tr>

<td align=”right” colspan=”2″>

</tr>

</table>

</tr>

</table>

<table width=”100%”><tr><td>

<p align=”justify” style=”color:#212020; width:800px;”>

Verbiage below login

</p>

</td></tr>

</table>

</layouttemplate>

</asp:login><div id=”resetPass” align=”center” style=”display:none”>

<asp:Label ID=”lblPR” runat=”server” ForeColor=”red” Font-Bold=”true”></asp:Label><br />

<asp:PasswordRecovery ID=”PasswordRecovery1″ runat=”server”

BackColor=”White” BorderColor=”white” BorderPadding=”4″ BorderStyle=”Solid” BorderWidth=”1px” Font-Names=”Verdana” Font-Size=”1.2em”>

<MailDefinition Priority=”High” Subject=”Password reset per your request” From=”sharepoint@mycompany.com” />

<InstructionTextStyle Font-Italic=”True” ForeColor=”Black” />

<SuccessTextStyle Font-Bold=”True” ForeColor=”#507CD1″ />

<TextBoxStyle Font-Size=”1.2em” />

<TitleTextStyle BackColor=”#507CD1″ Font-Bold=”True” Font-Size=”1.2em” ForeColor=”White” />

<UserNameTemplate>

<table border=”0″ cellpadding=”1″>

<tr>

<td>

<table border=”0″ cellpadding=”0″>

<tr>

<td align=”center” colspan=”2″>

<asp:Label runat=”server” ID=”enterName” Text=”Enter your email to reset your password.” Font-Size=”1.2em”></asp:Label></td>

</tr>

<tr>

<td align=”right”>

<asp:Label ID=”UserNameLabel” Font-Size=”1.2em” runat=”server” AssociatedControlID=”UserName”>User Name:</asp:Label></td>

<td>

<asp:TextBox ID=”UserName” runat=”server”></asp:TextBox>

<asp:RequiredFieldValidator ID=”UserNameRequired” runat=”server” ControlToValidate=”UserName”

ErrorMessage=”User Name is required.” ToolTip=”User Name is required.” ValidationGroup=”PasswordRecovery1″>*</asp:RequiredFieldValidator>

</td>

</tr>

<tr>

<td align=”center” colspan=”2″ style=”color: red”>

<asp:Literal ID=”FailureText” runat=”server” EnableViewState=”False”></asp:Literal>

</td>

</tr>

<tr>

<td align=”left”>

<b><a href=”javascript:showHide()”>Return to Login</a></b>

</td>

<td align=”right”>

<asp:Button ID=”SubmitButton” runat=”server” CommandName=”Submit” Text=”Submit” ValidationGroup=”PasswordRecovery1″ />

</td>

</tr>

</table>

</td>

</tr>

</table>

</UserNameTemplate>

<SuccessTemplate>

<table border=”0″ cellpadding=”4″ cellspacing=”0″ style=”border-collapse: collapse;”>

<tr>

<td>

<table border=”0″ cellpadding=”0″>

<tr>

<td style=”color: #507CD1; font-weight: bold;”>

<asp:literal runat=”server” Text=”Password has been reset and emailed to you.” /></td>

<a href=”javascript:showHide()”>Return to Login</a>

</tr>

</table>

</td>

</tr>

</table>

</SuccessTemplate>

<SubmitButtonStyle BackColor=”White” BorderColor=”#507CD1″ BorderStyle=”Solid” BorderWidth=”1px”

Font-Names=”Verdana” Font-Size=”0.8em” ForeColor=”#284E98″ />

</asp:PasswordRecovery>

</div>

</div>

</div>

</asp:Content>

  1. No comments yet.
(will not be published)


%d bloggers like this: