示例#1
0
        public WebReply btnResetPassword_Click()
        {
            string sUsername = Sys.GetObjectValue("Login", "Username");
            // Verify the user exists
            string sql    = "Select id,email from Users where username='******'";
            string id     = Sys._data.GetScalarString(sql, "id");
            string sEmail = Sys._data.GetScalarString(sql, "email");
            string sNarr  = "";

            if (id.Length == 0)
            {
                sNarr = "Unable to retrieve a user with that username";
            }
            else if (!Sys.IsValidEmailFormat(sEmail))
            {
                sNarr = "Email address on file for this user is not valid.  Please send an e-mail to [email protected].";
            }
            else
            {
                sNarr = "Password reset instructions have been sent to the e-mail address on file.  Please click the link in your e-mail and follow the instructions in order to reset your password.";
                // Send the email here
                string sLink = HttpContext.Current.Request.Url.ToString();
                sLink  = sLink.Substring(0, sLink.Length - 10);
                sLink += "/Action.aspx?action=password_recovery&id=" + id.ToString();

                string sBody = "Dear " + sUsername.ToUpper() + ",<br><br>Please follow these instructions to reset your Pool Password:<br><br>Click the link below, and after browser authentication, the pool will reset your password to a new password.  <br><br>Copy the new password from the screen, then log in, and then optionally change your password.<br><br><a href='" + sLink + "'>Recover Password</a><br><br>Thank you for using BiblePay.<br><br>Best Regards,<br>BiblePay Support";

                bool sent = Sys.SendEmail(sEmail, "BiblePay Pool Password Recovery", sBody, true);

                string sErr = "";
            }

            Dialog   d  = new Dialog(Sys);
            WebReply wr = d.CreateDialog("PASSWORD_RECOVERY", "PASSWORD_RECOVERY", sNarr, 425, 200);

            return(wr);
        }