예제 #1
0
 protected void ResetPasswordLink_Click(object sender, EventArgs e)
 {
     if (AppLogic.MailServer().Length == 0 || AppLogic.MailServer() == AppLogic.ro_TBD)
     {
         ResetPasswordError.Visible = true;
     }
     else
     {
         Password  p = new Password(AspDotNetStorefrontEncrypt.Encrypt.CreateRandomStrongPassword(8));
         Affiliate a = new Affiliate(affiliateID);
         try
         {
             String Subject = AppLogic.AppConfig("StoreName") + " - " + AppLogic.AppConfig("AppConfig.AffiliateProgramName") + " - " + AppLogic.GetString("cst_account_process.aspx.1", 1, Localization.GetDefaultLocale());
             String Body    = AppLogic.RunXmlPackage("notification.lostpassword.xml.config", null, null, 1, "", "thisaffiliateid=" + a.AffiliateID.ToString() + "&newpwd=" + p.ClearPassword, false, false);
             AppLogic.SendMail(Subject, Body, true, AppLogic.AppConfig("MailMe_FromAddress"), AppLogic.AppConfig("MailMe_FromName"), a.EMail, (a.FirstName + " " + a.LastName).Trim(), "", "", AppLogic.MailServer());
             ResetPasswordOk.Visible = true;
             a.Update(null, p.SaltedPassword, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, p.Salt);
         }
         catch
         {
             ResetPasswordOk.Visible    = false;
             ResetPasswordError.Visible = true;
         }
     }
 }
        public void btnLostPassword_Click(object sender, EventArgs e)
        {
            if (ResetPwdEMail.Text.Trim().Length == 0)
            {
                lblReqPwdErr.Text = "Please enter a valid email address";
                return;
            }

            String    AffName = AppLogic.GetString("AppConfig.AffiliateProgramName", 1, Localization.GetDefaultLocale());
            Affiliate a       = new Affiliate(ResetPwdEMail.Text);

            if (a.AffiliateID != -1)
            {
                Password p = new Password();
                a.Update(null, p.SaltedPassword, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, p.Salt);
                try
                {
                    AppLogic.SendMail(AffName + " Password", AppLogic.RunXmlPackage("notification.lostpassword.xml.config", null, ThisCustomer, ThisCustomer.SkinID, "", "thisaffiliateid=" + a.AffiliateID.ToString() + "&newpwd=" + p.ClearPassword + "&AffName=" + AffName, false, false), true, AppLogic.AppConfig("AffiliateEMailAddress"), AppLogic.AppConfig("AffiliateEMailAddress"), a.EMail, a.EMail, "", AppLogic.MailServer());
                    lblReqPwdErr.Text = "Your new password has been sent.";
                }
                catch
                {
                    lblReqPwdErr.Text = "There were problems emailing your password please try again later.";
                }
            }
            else
            {
                lblReqPwdErr.Text = "There is no registered " + AffName + " member with that e-mail address!";
            }
        }
예제 #3
0
        private void ProcessAccountUpdate()
        {
            Affiliate a = new Affiliate(AffiliateID);

            Page.Validate();
            if (Page.IsValid && a.AffiliateID != -1)
            {
                try
                {
                    string pwd     = null;
                    object saltkey = null;
                    if (AffPassword.Text.Trim().Length > 0)
                    {
                        Password p = new Password(AffPassword.Text, a.SaltKey);
                        pwd     = p.SaltedPassword;
                        saltkey = p.Salt;
                    }

                    object dob = Localization.ParseNativeDateTime(DOBTxt.Text);
                    if ((DateTime)dob == DateTime.MinValue)
                    {
                        dob = null;
                    }


                    String theUrl2 = CommonLogic.Left(URL.Text, 80);
                    if (theUrl2.IndexOf("http://") == -1 && theUrl2.Length != 0)
                    {
                        theUrl2 = "http://" + theUrl2;
                    }

                    string Name = FirstName.Text + " " + LastName.Text;

                    a.Update(EMail.Text.ToLowerInvariant().Trim(), pwd, dob, null, null, CommonLogic.IIF(CommonLogic.FormCanBeDangerousContent("URL").Length == 0, 0, 1), CommonLogic.Left(FirstName.Text, 50), CommonLogic.Left(LastName.Text, 50), CommonLogic.Left(Name, 100), Company.Text, Address1.Text.Replace("\x0D\x0A", ""), Address2.Text.Replace("\x0D\x0A", ""), Suite.Text, City.Text, State.SelectedValue, Zip.Text, Country.SelectedValue, AppLogic.MakeProperPhoneFormat(Phone.Text), WebSiteName.Text, WebSiteDescription.Text, theUrl2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, saltkey);

                    lblErrMsg.Text = "Account Updated";
                }
                catch
                {
                    lblErrMsg.Text = "<p><b>ERROR: There was an unknown error in updating your new account record. Please <a href=\"contactus.aspx\">contact a service representative</a> for assistance.</b></p>";
                }

                Profile.LATAffiliateID = a.AffiliateID.ToString();

                InitializePageContent();
            }
            else
            {
                lblErrorMsg.Text += " Some errors occurred trying to create your affiliate account.  Please correct them and try again.";
                foreach (IValidator aValidator in this.Validators)
                {
                    if (!aValidator.IsValid)
                    {
                        lblErrorMsg.Text += "&bull; " + aValidator.ErrorMessage + "";
                    }
                }
                lblErrorMsg.Text += "";
            }
        }