Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris McVittie 103 posts 75 karma points
    Feb 25, 2010 @ 23:19
    Chris McVittie
    0

    Password Recovery help required

    Hi, 

    I've got myself completely stumped by an issue with the Password recover.

    I'm getting the following error when entering a valid username:

    Your attempt to retrieve your password was not successful. Please try again.

    I feel like I've exhausted all possibilities of investigation, but the bottom line is - I don't know how to get a more specific error message.

    Things I have tried

    • umbracoMemberShipProvider -> enablePasswordReset=true in web.config
    • created an email template for password recovery as textfile in my user controls folder
    • debug umbraco source in Visual studio with Exceptions > Common Runtime Exceptions, turned on  --> doing this, I was able to verify that the umbracoMembershipProvider is correctly returning from the GetUser() implementation, and from that point on, no more code is exectued.  The "resetPassword" method isn't hit.
    Here is my source code for the reset - but I suspect it isn't relevant. (I'm also using Dirk's use email/username feature, but can confirm that this isn't interferring - the correct username is being passed to the provider).
    Many thanks, 
    Chris
    <%@ Master Language="C#" MasterPageFile="/masterpages/LoginPages.master" AutoEventWireup="true" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            PasswordRecovery1.VerifyingUser += new LoginCancelEventHandler(PasswordRecovery_VerifyingUser);
        }
    
        protected void PasswordRecovery_VerifyingUser(object sender, LoginCancelEventArgs e)
        {
            umbraco.cms.businesslogic.member.Member currentMember = umbraco.cms.businesslogic.member.Member.GetMemberFromEmail(PasswordRecovery1.UserName);
    
            if (currentMember == null)
                currentMember = umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(PasswordRecovery1.UserName);
    
            if (currentMember != null && currentMember.Id > 0)
            {
                PasswordRecovery1.UserName = currentMember.LoginName;
            }
            else
            {
                e.Cancel = true;
            }
        }
    
    
    </script>
    
    <asp:Content ContentPlaceHolderID="LoginHolder" runat="server">
        <!-- Insert "LoginHolder" markup here -->
        <asp:passwordrecovery id="PasswordRecovery1" runat="server" 
            SuccessPageUrl="~/Account/Login.aspx">
        <MailDefinition BodyFileName="~/usercontrols/PasswordEmail.txt" 
                From="[email protected]" 
                Subject="[Website] - Your Password"></MailDefinition>
        <UserNameTemplate>
          <div class="contentbox">
    
                              <fieldset class="ui-corner-all">
                                <legend>
                                <h1>Please enter your user name to get your new password</h1>
                                <p>This is usually your initial + your surname.  If successful, you will be emailed a new password.</p>
                                </legend>
          <p>
           <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
    
                                    <asp:TextBox ID="UserName" runat="server" cssclass="title"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" 
                                        ControlToValidate="UserName" ErrorMessage="User Name is required." 
                                        ToolTip="User Name is required." ValidationGroup="ctl00$PasswordRecovery1">*</asp:RequiredFieldValidator>
                        </p><p><asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
          </p>
          <p><asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" 
                                        ValidationGroup="ctl00$PasswordRecovery1" 
                  Width="95px" />
             </p>                           
          </fieldset>
             </div>             
    
        </UserNameTemplate>
    </asp:passwordrecovery>
    </asp:Content>

  • Chris McVittie 103 posts 75 karma points
    Mar 06, 2010 @ 00:11
    Chris McVittie
    0

    I found the solution to this - turns out the requiresQuestionAndAnswer="true" that I had in my config file was breaking it.  I haven't worked out why, but I suspect umbraco should maybe be throwing an exception when this is set and the other linked properties aren't so that the membership provider doesn't get confused.

Please Sign in or register to post replies

Write your reply to:

Draft