Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ReturnURL.Text = CommonLogic.QueryStringCanBeDangerousContent("ReturnURL");
            if (ReturnURL.Text.IndexOf("<script>", StringComparison.InvariantCultureIgnoreCase) != -1)
            {
                throw new ArgumentException("SECURITY EXCEPTION");
            }

            string errorMsg = CommonLogic.QueryStringCanBeDangerousContent("ErrorMsg");

            if (errorMsg.Trim().Length != 0)
            {
                ErrorMsgLabel.Text = errorMsg;
                ErrorPanel.Visible = true;
            }

            RequireSecurePage();

            if (!Page.IsPostBack)
            {
                DoingCheckout.Checked = CommonLogic.QueryStringBool("checkout");
                if (ReturnURL.Text.Length == 0)
                {
                    ReturnURL.Text = CommonLogic.QueryStringBool("checkout") ? "shoppingcart.aspx?checkout=true" : "default.aspx";
                }

                try
                {
                    string cookieValue = CookieTool.GetValue(REMEMBERME_COOKIE_NAME);
                    if (!string.IsNullOrEmpty(cookieValue) && CommonLogic.IsValidGuid(cookieValue))
                    {
                        var customerGuid       = new Guid(cookieValue);
                        var rememberMeCustomer = Customer.Find(customerGuid);
                        EMail.Text = rememberMeCustomer.EMail;
                        this.Password.Attributes.Add("value", rememberMeCustomer.GetPassword());
                        this.PersistLogin.Checked = true;
                    }
                }
                catch
                {
                    EMail.Text    = string.Empty;
                    Password.Text = string.Empty;
                }

                SignUpLink.NavigateUrl = "createaccount.aspx?checkout=" + DoingCheckout.Checked.ToString();
            }

            if (AppLogic.AppConfigBool("SecurityCodeRequiredOnStoreLogin"))
            {
                // Create a random code and store it in the Session object.
                SecurityCodePanel.Visible  = true;
                SecurityImagePanel.Visible = true;
                SecurityImage.ImageUrl     = "Captcha.ashx?id=1";
            }

            HeaderMsg.SetContext = this;
        }