Ejemplo n.º 1
0
        private void btnEditLoginPassword_Click(object sender, EventArgs e)
        {
            Distributor user = SubsiteStoreHelper.GetDistributor();

            if (string.IsNullOrEmpty(txtOldPassword.Text))
            {
                ShowMsg("旧登录密码不能为空", false);
            }
            else if ((string.IsNullOrEmpty(txtNewPassword.Text) || (txtNewPassword.Text.Length > 20)) || (txtNewPassword.Text.Length < 6))
            {
                ShowMsg("新登录密码不能为空,长度限制在6-20个字符之间", false);
            }
            else if (txtNewPassword.Text != txtPasswordCompare.Text)
            {
                ShowMsg("两次输入的密码不一致", false);
            }
            else if (user.ChangePassword(txtOldPassword.Text, txtNewPassword.Text))
            {
                Messenger.UserPasswordChanged(user, txtNewPassword.Text);
                user.OnPasswordChanged(new UserEventArgs(user.Username, txtNewPassword.Text, null));
                ShowMsg("登录密码修改成功", true);
            }
            else
            {
                ShowMsg("登录密码修改失败", false);
            }
        }
        private void btnEditDistributorLoginPassword_Click(object sender, EventArgs e)
        {
            Distributor user = DistributorHelper.GetDistributor(this.userId);

            if ((string.IsNullOrEmpty(this.txtNewPassword.Text) || (this.txtNewPassword.Text.Length > 20)) || (this.txtNewPassword.Text.Length < 6))
            {
                this.ShowMsg("登录密码不能为空,长度限制在6-20个字符之间", false);
            }
            else if (this.txtNewPassword.Text != this.txtPasswordCompare.Text)
            {
                this.ShowMsg("输入的两次密码不一致", false);
            }
            else if (user.ChangePassword(this.txtNewPassword.Text))
            {
                Messenger.UserPasswordChanged(user, this.txtNewPassword.Text);
                user.OnPasswordChanged(new UserEventArgs(user.Username, this.txtNewPassword.Text, null));
                this.ShowMsg("登录密码修改成功", true);
            }
            else
            {
                this.ShowMsg("登录密码修改失败", false);
            }
        }