Can't offer advice on your problem, but why aren't you using the asp.net controls for recovering passwords? It's dead drop easy, no need for any additional code. Also, be sure that password recovering is not possible when passwordFormat="Hashed"!!
Ok, you're not a developer... but it doesn't actually require programming knowledge, it's just a plain asp.net control which you drop onto a template and set some properties and that's it!
Don't know much about the functioning of the membercontrols package from the repo, so not sure whether those use the membership provider info found in web.config
Is it possible to rertrive the infor using the memebers email instead of username? Mu members always forget their username, but can always remember their email
Yes, that's possible but will require some coding from your part.
PasswordRecovery has a bunch of events that fire when using it, one of those is the VerifyingUser event which is triggered just before the user name is sent to the Membership provider. In your case, you'll have to perform an additional lookup on the member (find username from email) and send that info instead of e-mail (as the membership provider will only look at the username provided through the control)
And, you'll have to change the layout slightly (UserNameTemplate)
I don't have any example here atm (have already done exactly the same thing in another project) but can dig that up for you tonight. Send me a mail at dirk at netaddicts dot be if you want it.
My bad, sorry for late reply, was a bit forgotten about it! Ok, here's mail content I've sent to Claus a few weeks ago...
I'm not sure whether you're actually using user controls (and macro) or using the asp.net controls directly from template, but I'll explain using the second method:
Onto your template, drop (well, copy'n'paste) a asp.net PasswordRecovery control
<asp:PasswordRecovery ID="UsernameRecovery" runat="server" MailDefinition-BodyFileName="RecoverUsername.txt">
<UserNameTemplate>
<fieldset>
<legend>Recover username</legend>
<p>
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
<asp:ValidationSummary ID="UsernameRecoveryValidationSummary" runat="server" DisplayMode="BulletList"
ValidationGroup="UsernameRecovery" />
</p>
<p>
<label id="UserNameLabel" for="UserName">
Email:</label>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
ErrorMessage="*" ToolTip="User Name is required." ValidationGroup="UsernameRecovery">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" ValidationGroup="UsernameRecovery" />
</p>
</fieldset>
</UserNameTemplate>
<SuccessTemplate>Your username has been sent to you.</SuccessTemplate>
</asp:PasswordRecovery>
I'm pretty sure you know now how to use MailDefinition-BodyFileName property.
Key here is that we'll ask the user to enter his email address (mind the 'Email:' value for the 'UserNameLabel' label - don't change the names of the fields, they're reserved words!!), we'll subscribe to an event that is fired just before that info is sent to the membership provider (which will take care of the lookup of the password based on username) and when that event is fired, we'll substitute the value (e-mail address entered in 'UserName' textbox) with the username that corresponds to that email address (using the umbraco api). Membership provider is happy cause it'll receivee a username, we're happy because our users can still enter e-mail addresses.
If I'm really talking rubbish or would like some more clarification, feel free to ask!
Here's the code snippet for the events subscribing and handling.
Even better approach is to no longer use the Member API but use the Membership API for retrieving the member based on the email. I'll leave that as an exercise :p
Hmm.. I can't quite get this to work. The macro displays OK but it doesn't recognise a valid email address. I always get "We were unable to access your information. Please try again." even though the email address is a member's. No email is sent (I added the mailDefinition info):
Member password reminder not sending info
Im using the Member control package by Niels, but the Password reminder function doesnt seem to actually send out the forgotten password.
I get an email, with the text i defined on the maco, but the password is not in the mail?!?!
Any ideas. its 4.0.2.1
Hi,
Can't offer advice on your problem, but why aren't you using the asp.net controls for recovering passwords? It's dead drop easy, no need for any additional code. Also, be sure that password recovering is not possible when passwordFormat="Hashed"!!
Cheers,
/Dirk
Because im a designer, not a devolper :)
And because the membercontrols is a repository package, and i therefore thought it would be "Best practice" to use this.
I've now changed the following in the web config:
<add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="true" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Another Type" passwordFormat="Clear" />
But i still dont get the info in the mail.
Ok, you're not a developer... but it doesn't actually require programming knowledge, it's just a plain asp.net control which you drop onto a template and set some properties and that's it!
Some references: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.passwordrecovery.maildefinition.aspx and http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.maildefinition.bodyfilename.aspx
Don't know much about the functioning of the membercontrols package from the repo, so not sure whether those use the membership provider info found in web.config
Cheers,
/Dirk
Cool, it works, thanks
Is it possible to rertrive the infor using the memebers email instead of username? Mu members always forget their username, but can always remember their email
Yes, that's possible but will require some coding from your part.
PasswordRecovery has a bunch of events that fire when using it, one of those is the VerifyingUser event which is triggered just before the user name is sent to the Membership provider. In your case, you'll have to perform an additional lookup on the member (find username from email) and send that info instead of e-mail (as the membership provider will only look at the username provided through the control)
And, you'll have to change the layout slightly (UserNameTemplate)
I don't have any example here atm (have already done exactly the same thing in another project) but can dig that up for you tonight. Send me a mail at dirk at netaddicts dot be if you want it.
Cheers,
/Dirk
@Claus: I've sent you an e-mail with details on how to retrieve passwords when users are only entering their email address instead of username.
Cheers,
/Dirk
Hi Dirk,
Could you post that here as well? It would be quite handy for others :)
Cheers
SP
Ok SImon, I'll see if I can digg up the code today.
Cheers,
/Dirk
Hi Dirk,
Did u "digg up the code" ? - I need to figure it out as well :)
Password retrieval from the members section (only email + password are used, no name or anything ;)
/Chief
Ha Chief
My bad, sorry for late reply, was a bit forgotten about it! Ok, here's mail content I've sent to Claus a few weeks ago...
I'm not sure whether you're actually using user controls (and macro) or using the asp.net controls directly from template, but I'll explain using the second method:
Onto your template, drop (well, copy'n'paste) a asp.net PasswordRecovery control
I'm pretty sure you know now how to use MailDefinition-BodyFileName property.
Key here is that we'll ask the user to enter his email address (mind the 'Email:' value for the 'UserNameLabel' label - don't change the names of the fields, they're reserved words!!), we'll subscribe to an event that is fired just before that info is sent to the membership provider (which will take care of the lookup of the password based on username) and when that event is fired, we'll substitute the value (e-mail address entered in 'UserName' textbox) with the username that corresponds to that email address (using the umbraco api). Membership provider is happy cause it'll receivee a username, we're happy because our users can still enter e-mail addresses.
If I'm really talking rubbish or would like some more clarification, feel free to ask!
Here's the code snippet for the events subscribing and handling.
Cheers and good luck.
/Dirk
Hmm.. I can't quite get this to work. The macro displays OK but it doesn't recognise a valid email address. I always get "We were unable to access your information. Please try again." even though the email address is a member's. No email is sent (I added the mailDefinition info):
<MailDefinition BodyFileName="~/usercontrols/RecoverUsername.txt" From="[email protected]" Subject="Your account information" />
This is the Username.txt file:
Your user name is: <%UserName%>
Your password is: <%Password%>
These fields are automatically filled in, right?
is working on a reply...