Пример #1
0
        private void btnSetPassword_Click(object sender, EventArgs e)
        {
            string     userName   = Globals.StripAllTags(this.txtUserName.Text.Trim());
            MemberInfo memberInfo = MemberProcessor.FindMemberByUsername(userName);
            bool       flag       = false;

            if (string.IsNullOrEmpty(this.txtPassword.Text.Trim()) || string.IsNullOrEmpty(this.txtRePassword.Text.Trim()))
            {
                this.ShowMessage("密码不允许为空!", false, "", 1);
            }
            else if (this.txtPassword.Text.Trim() != this.txtRePassword.Text.Trim())
            {
                this.ShowMessage("两次输入的密码需一致", false, "", 1);
            }
            else if (this.txtPassword.Text.Length < 6 || this.txtPassword.Text.Length > HiConfiguration.GetConfig().PasswordMaxLength)
            {
                this.ShowMessage($"密码的长度只能在{6}和{HiConfiguration.GetConfig().PasswordMaxLength}个字符之间", false, "", 1);
            }
            else if (MemberProcessor.ChangePassword(memberInfo, this.txtPassword.Text))
            {
                Messenger.UserPasswordForgotten(memberInfo, this.txtPassword.Text);
                this.Page.Response.Redirect($"/ForgotPasswordSuccess?UserName={memberInfo.UserName}");
            }
            else
            {
                this.ShowMessage("登录密码修改失败,请重试", false, "", 1);
            }
        }
Пример #2
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.txtPassword.Value))
     {
         this.message.Text = "密码不能为空";
     }
     else if (this.txtPassword.Value != this.txtPassword2.Value)
     {
         this.message.Text = "两次密码输入不一致,请重新输入";
     }
     else
     {
         MemberDao  memberDao  = new MemberDao();
         bool       flag       = true;
         MemberInfo memberInfo = memberDao.FindMemberByCellphone(this.username);
         if (memberInfo == null)
         {
             memberInfo = memberDao.FindMemberByEmail(this.username);
         }
         if (DataHelper.IsEmail(this.username))
         {
             flag = false;
         }
         if (memberInfo != null)
         {
             string value = this.txtNumber.Value;
             string text  = "验证码错误";
             if ((flag && HiContext.Current.CheckPhoneVerifyCode(value, memberInfo.CellPhone, out text)) || (!flag && HiContext.Current.CheckVerifyCode(value, "")))
             {
                 if (MemberProcessor.ChangePassword(memberInfo, this.txtPassword2.Value))
                 {
                     Messenger.UserPasswordChanged(memberInfo, this.txtPassword2.Value);
                     Users.SetCurrentUser(memberInfo.UserId, 1, true, false);
                     ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart();
                     if (cookieShoppingCart != null)
                     {
                         ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart);
                         ShoppingCartProcessor.ClearCookieShoppingCart();
                     }
                     this.Page.Response.Redirect("MemberCenter.aspx", true);
                 }
             }
             else
             {
                 this.message.Text = text;
             }
         }
         else
         {
             this.message.Text = "密码修改失败,错误的用户名";
         }
     }
 }
Пример #3
0
        protected void btnChangePassword_Click(object sender, EventArgs e)
        {
            MemberInfo user = HiContext.Current.User;

            if (user.PasswordSalt.ToLower() != "open" && user.Password != Users.EncodePassword(this.txtOdlPasswordChange.Text, user.PasswordSalt))
            {
                this.ShowMessage("当前登录密码输入错误", false, "", 1);
            }
            else if (this.txtNewPassword2Change.Text.Length < 6 || this.txtNewPassword2Change.Text.Length > 20)
            {
                this.ShowMessage("密码必须在6-20个字符之间!", false, "", 1);
            }
            else if (MemberProcessor.ChangePassword(HiContext.Current.User, this.txtNewPassword2Change.Text))
            {
                Messenger.UserPasswordChanged(HiContext.Current.User, this.txtNewPassword2Change.Text);
                this.ShowMessage("你已经成功的修改了登录密码", true, "", 1);
            }
        }
Пример #4
0
        private void btnEditUser_Click(object sender, EventArgs e)
        {
            MemberInfo user = Users.GetUser(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 (MemberProcessor.ChangePassword(user, this.txtNewPassWord.Text))
            {
                Messenger.UserPasswordChanged(user, this.txtNewPassWord.Text);
                this.ShowMsg("登录密码修改成功", true);
            }
            else
            {
                this.ShowMsg("登录密码修改失败", false);
            }
        }