protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         CAPTCHA.Validate();
         if (CAPTCHA.UserValidated)
         {
             MembershipUser user = Membership.GetUser(txtUserName.Text);
             if (user == null)
             {
                 ErrorLabel.Text = "Unknown userid";
             }
             else
             {
                 string password = user.ResetPassword();
                 SendMailDL.SendMail(user.Email, user.Email, "Reset password from Art Gallery Site",
                                     string.Format("Your new password is {0}", password), false);
                 ErrorLabel.Text = "Your new password has been emailed to you.";
             }
         }
         else
         {
             ErrorLabel.Text = "The code you entered did not match up with the image provided; please try again with this new image.";
         }
     }
     catch (Exception ex)
     {
         ErrorLabel.Text = "Process Error";
         ErrorLogDL.Insert(ex);
     }
     up1.Update();
 }
예제 #2
0
 /// <summary>
 /// Event triggered when user selects Send Test Email button. This method
 /// sends a test message to the user from himself.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (SendMailDL.SendMail("Test Email from Art Gallery Site", "This is a test of the Art Gallery Site Email Method", false))
     {
         ErrorLabel.Text = "Sent";
     }
     else
     {
         ErrorLabel.Text = "Failed to Send";
     }
 }