LoginView 내부에 빌드 된 하이퍼 링크가 있으며 텍스트가 "비밀번호 분실"으로 설정되어 있습니다.비밀번호 복구가 이메일을 보내지 않습니다.
하이퍼 링크를 클릭하면 암호 복구 제어 도구가 나타납니다 (AJAX ModalPopUp Extender 구현과 함께). modalpopup이 잘 작동합니다. 그러나 문제는 사용자가 보안 답변에 응답 한 후 사용자 이름을 입력 한 후 2 단계에서 '제출'버튼을 누르면 3 단계로 진행되지 않고 이메일이 전송되지 않습니다.
그러나 암호가 데이터베이스에서 변경되었습니다 (사용자 이름과 이전 암호로 로그인하려했으나 작동하지 않았습니다).
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
System.Web.UI.WebControls.PasswordRecovery PasswordRecovery1 = (System.Web.UI.WebControls.PasswordRecovery)LoginView1.FindControl("PasswordRecovery1");
MembershipUser pwRecover = Membership.GetUser(PasswordRecovery1.UserName);
Guid userInfoId2 = (Guid)pwRecover.ProviderUserKey;
//Create an url that will link to a UserProfile.aspx and
//accept a query string that is the user's id
//setup the base of the url
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
//setup the second half of the url
string confirmationPage = "/Members/UserProfile.aspx?ID=" + userInfoId2.ToString();
//combine to make the final url
string url = domainName + confirmationPage;
// Replace <%VerifyUrl%> placeholder with url value
e.Message.Body = e.Message.Body.Replace("<%ResetPassword%>", url);
}
- 나는 ModalPopUp에서 암호 복구 컨트롤을 제거하면, 전체 제어 작업 : 여기
<asp:HyperLink ID="HyperLink2" runat="server" style="margin-top:15px; text-align: right;">Forget Password</asp:HyperLink> <asp:ModalPopupExtender ID="HyperLink2_ModalPopupExtender" runat="server" BackgroundCssClass="modalBackground" DynamicServicePath="" Enabled="True" PopupControlID="Panel1" TargetControlID="HyperLink2" > </asp:ModalPopupExtender> <asp:Panel ID="Panel1" runat="server" BackColor="White" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" Height="200px" Width="360px"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:PasswordRecovery ID="PasswordRecovery1" runat="server" onsendingmail="PasswordRecovery1_SendingMail"> <MailDefinition BodyFileName="~/EmailTemplates/ResetPassword.htm" From="[email protected]" IsBodyHtml="True" Priority="High" Subject="Request on the password reset for BedOfRoses's account."> </MailDefinition> </asp:PasswordRecovery> </ContentTemplate> </asp:UpdatePanel> <asp:Button ID="btnClose" runat="server" Text="Close" /> </asp:Panel>
뒤에 코드는 다음과 같습니다
는 passwordrecover.aspx에서 코드입니다 아주. ModalPopUp 내부에 빌드 된 경우에만 마지막 단계로 진행할 수 없으며 전자 메일이 전송되지 않습니다. 그러나 사용자는 자신의 사용자 이름과 이전 암호로 로그인 할 수 없습니다.