Example #1
0
 /// <summary>
 /// 加查输入的有效性
 /// </summary>
 public override bool CheckInput()
 {
     // 密码强度检查
     if (BaseSystemInfo.CheckPasswordStrength)
     {
         // 原密码为空
         if (this.txtOldPassword.Text.Length == 0)
         {
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9961), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtOldPassword.Focus();
             return(false);
         }
         // 新密码为空
         if (this.txtNewPassword.Text.Length == 0)
         {
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9959), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtNewPassword.Focus();
             return(false);
         }
         // 确认密码为空
         if (this.txtConfirmPassword.Text.Length == 0)
         {
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9960), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtConfirmPassword.Focus();
             return(false);
         }
         if (!BaseCheckInput.CheckPasswordStrength(this.txtNewPassword))
         {
             return(false);
         }
     }
     // 新密码不一致
     if (this.txtConfirmPassword.Text != this.txtNewPassword.Text)
     {
         MessageBox.Show(AppMessage.Format(AppMessage.MSG0039, AppMessage.MSG9959, AppMessage.MSG9960), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.ClearNewPassword();
         return(false);
     }
     if (this.txtDigitalSignature.Text.Length == 0)
     {
         MessageBox.Show("请选择签名密钥文件存放位置。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.btnSelectDigitalSignature.Focus();
         return(false);
     }
     else
     {
         if (!System.IO.File.Exists(this.txtDigitalSignature.Text))
         {
             this.txtDigitalSignature.Text = string.Empty;
             MessageBox.Show("请选择签名密钥文件存放位置。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.btnSelectDigitalSignature.Focus();
             return(false);
         }
     }
     return(true);
 }
Example #2
0
        /// <summary>
        /// 检查输入的有效性
        /// </summary>
        /// <returns>有效</returns>
        public override bool CheckInput()
        {
            bool returnValue = true;

            this.txtUserName.Text = this.txtUserName.Text.TrimEnd();
            if (this.txtUserName.Text.Trim().Length == 0)
            {
                MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9957), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtUserName.Focus();
                return(false);
            }
            // 这里需要检查系统设置的用户名长度限制
            if (BaseSystemInfo.CheckPasswordStrength && BaseSystemInfo.AccountMinimumLength > 0)
            {
                if (this.txtUserName.Text.Trim().Length < BaseSystemInfo.AccountMinimumLength)
                {
                    MessageBox.Show(AppMessage.Format(AppMessage.MSG0026, AppMessage.MSG9957, BaseSystemInfo.AccountMinimumLength.ToString()), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtUserName.Focus();
                    return(false);
                }
            }
            this.txtRealName.Text = this.txtRealName.Text.TrimEnd();
            if (this.txtRealName.Text.Trim().Length == 0)
            {
                MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9978), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtRealName.Focus();
                return(false);
            }

            // 密码不能为空
            if (BaseSystemInfo.CheckPasswordStrength)
            {
                if (this.txtPassword.Text.Trim().Length == 0)
                {
                    MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9964), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtPassword.Focus();
                    return(false);
                }
                if (!BaseCheckInput.CheckPasswordStrength(this.txtPassword))
                {
                    return(false);
                }
            }
            if (!this.txtConfirmPassword.Text.Equals(this.txtPassword.Text))
            {
                MessageBox.Show(AppMessage.MSG9967, AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtPassword.Clear();
                this.txtConfirmPassword.Clear();
                this.txtPassword.Focus();
                return(false);
            }
            return(returnValue);
        }
 /// <summary>
 /// 加查输入的有效性
 /// </summary>
 public override bool CheckInput()
 {
     // 密码强度检查
     if (BaseSystemInfo.CheckPasswordStrength)
     {
         // 原来密码为空
         if (this.txtOldPassword.Text.Length == 0)
         {
             // 判断是否为确认按钮
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9961), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtOldPassword.Focus();
             return(false);
         }
         // 新密码为空
         if (this.txtNewPassword.Text.Length == 0)
         {
             // 判断是否为确认按钮
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9959), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtNewPassword.Focus();
             return(false);
         }
         // 确认密码为空
         if (this.txtConfirmPassword.Text.Length == 0)
         {
             MessageBox.Show(AppMessage.Format(AppMessage.MSG0007, AppMessage.MSG9960), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.txtConfirmPassword.Focus();
             return(false);
         }
         if (!BaseCheckInput.CheckPasswordStrength(this.txtNewPassword))
         {
             return(false);
         }
     }
     // 新密码不一致
     if (this.txtConfirmPassword.Text != this.txtNewPassword.Text)
     {
         MessageBox.Show(AppMessage.Format(AppMessage.MSG0039, AppMessage.MSG9959, AppMessage.MSG9960), AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.ClearNewPassword();
         return(false);
     }
     return(true);
 }