This project has moved and is read-only. For the latest updates, please go here.

Retrieve password web part from custom login?

Oct 14, 2013 at 8:25 PM
I was curious if there is an accepted way to add the "Retrieve Password" web part, or an analog of it to an external facing custom FBA login page?
Oct 14, 2013 at 11:04 PM
Edited Oct 14, 2013 at 11:04 PM
Per the karmic internet rul, I figured this out 5 minutes after I posted it.

Simply add two lines to your login.aspx page to get a password retrieval webpart:
In the declarations add:
<%@ Register TagPrefix="FBA" Namespace="Visigo.Sharepoint.FormsBasedAuthentication" Assembly="Visigo.Sharepoint.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9dba9f460226d31d" %>

and in the content area:
<div>
     <FBA:PasswordRecoveryWebPart runat="server"  />
</div>
super easy. Now if I could just figure out how to left justify the text that appears in the retrieval window I would be all good.

Great library by the way! Saved me hours upon hours of setting up FBA in an user friendly way.
Dec 1, 2013 at 8:55 AM
Have tried on your approach, the webpart appear accordingly but the button is disable. The password retrieval not working as it disable, mind to share how you do it?
Wondering have you figure out how to left justify it?
Dec 1, 2013 at 10:53 PM
I've never seen the password recovery button with a disabled button. The only thing I can think is that maybe you don't have:
enablePasswordReset="true"
in your membership provider. Don't forget that if you change the settings in your membership provider to change them in all web.configs that contain that same membership provider: securetokenwebservice, machine.config, your web app web.configs...

As for left justify, include some css in the page to do the left justification.
Dec 2, 2013 at 5:08 PM
Below are my code... I have make the machine.config as enablePasswordReset="true" but still no luck... the changepassword inside SharePoint is working.

<%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Page Language="C#" Inherits="Microsoft.SharePoint.IdentityModel.Pages.FormsSignInPage" MasterPageFile="~/_layouts/15/errorv15.master" %>
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="FBA" Namespace="Visigo.Sharepoint.FormsBasedAuthentication" Assembly="Visigo.Sharepoint.FormsBasedAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9dba9f460226d31d" %>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
<SharePoint:EncodedLiteral runat="server"  EncodeMethod="HtmlEncode" Id="ClaimsFormsPageTitle" />
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<link type="text/css" rel="Stylesheet" href="css/login.css" />
<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var varSpanErrorID = $(".ms-error").attr("id");
    if ($("#" + varSpanErrrID).html().length > 0) {
        $("#" + varSpanErrorID).html("Invalid user or password.");
    }
    });
</script>
</asp:Content>

<asp:Content 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:') { var SslWarning = document.getElementById('SslWarning'); SslWarning.style.display = ''; } document.getElementById('SslWarning').style.display = 'none'; </script> <asp:login id="signInControl" FailureText="<%$Resources:wss,login_pageFailureText%>" runat="server" width="99%">
 <layouttemplate>
     <div class="form">
         <div id="divLoginDetail">
             <p style="text-align:center"><asp:Label ID="FailureText" Class="ms-error" runat="server" /></p>
             <table>
                 <tr>
                     <td>
                         <asp:Image ID="Image1" runat="server" ImageUrl="images/tqmsia.png" ImageAlign="Left" />
                     </td>
                     <td style="width:50px"></td>
                     <td style="vertical-align:top">
                         <div>
                             <table style="width:376px;vertical-align:top">             
                                 <tr><td style="height:30px"></td></tr>
                                 <tr>
                                     <td style="height:25px">
                                         <asp:Label ID="Label1" runat="server" Text="SharePoint Password Recovery" Font-Size="18px" Font-Bold="True" ForeColor="Black"></asp:Label>
                                     </td>
                                 </tr>
                                 <tr><td style="height:25px"></td></tr>
                                 <tr>
                                     <td style="text-align:left">
                                         <div>
                                             <FBA:PasswordRecoveryWebPart runat="server" />
                                        </div>
                                     </td>
                                 </tr>
                                 <tr>
                                     <td style="height:25px">
                                         <asp:TextBox ID="UserName" autocomplete="Off" runat="server" Class="ms-inputuserfield" Visible="false" />
                                     </td>
                                 </tr>
                                 <tr>
                                     <td style="height:25px">
                                         <asp:TextBox ID="password" TextMode="Password" autocomplete="off" runat="server" Class="ms-inputpasswordfield" Visible="false" />
                                     </td>
                                 </tr>
                                 <tr>
                                     <td style="height:25px">
                                         <asp:checkbox id="RememberMe" text="<%$SPHtmlEncodedResources:wss,login_pageRememberMe%>" runat="server" Visible="false" />
                                     </td>
                                 </tr>

                                 <tr>
                                     <td style="height:25px">
                                         <asp:Button ID="login" CommandName="Login" Text="<%$Resources:wss,login_pagetitle%>" runat="server" Visible="false" />
                                     </td>
                                 </tr>

                             </table>
                         </div>
                     </td>
                 </tr>
             </table>
         </div>
     </div>
 </layouttemplate>
</asp:login>
</asp:Content>
Dec 2, 2013 at 5:57 PM
Have found the issue, it is due to the errorv15.master default page width smaller than my actual require size cause the submit button disabled. After I change the page width to auto and it fix ^_^

Many thanks ccoulson for your guide above, it really save my time of creating new passwordrecovery page.