예제 #1
0
 private void OK()
 {
     if (Common.TextBoxChecked(this.tbPwd) && Common.TextBoxChecked(this.tbNewPwd) &&
         Common.TextBoxChecked(this.tbConfirm) && Common.PasswordConfirmed(tbNewPwd, tbConfirm) && tbNewPwd.Text.TrimEnd() != Common.User.Pwd)
     {
         Common.User.Pwd = this.tbNewPwd.Text.TrimEnd();
         Common.User.LastPwdChangedTime = DateTime.Now;
         UserInfoBLL _bll = new UserInfoBLL();
         if (_bll.UdateUser(Common.User))
         {
             Utils.ShowMessageBox(Messages.ResetPasswordSuccessfully, Messages.TitleNotification);
             Undo();
             //记录成功的日志
             if (Common.User.UserName != Common.SUPERUSER)
             {
                 logBll.InsertLog(() =>
                 {
                     Dictionary <string, object> dic = new Dictionary <string, object>();
                     dic.Add("OperateTime", DateTime.UtcNow);
                     dic.Add("Action", LogAction.ChangePassword);
                     dic.Add("UserName", Common.User.UserName);
                     dic.Add("FullName", Common.User.FullName);
                     dic.Add("Detail", Common.User.UserName);
                     dic.Add("LogType", LogAction.SystemAuditTrail);
                     return(dic);
                 });
             }
         }
         else
         {
             Utils.ShowMessageBox(Messages.ResetPasswordFailed, Messages.TitleError);
         }
         //form.Close();
     }
 }
예제 #2
0
 private void OK()
 {
     if (Common.TextBoxChecked(this.tbPwd) && Common.TextBoxChecked(this.tbNewPwd) &&
            Common.TextBoxChecked(this.tbConfirm) && Common.PasswordConfirmed(tbNewPwd, tbConfirm))
     {
         Common.User.Pwd = this.tbNewPwd.Text.TrimEnd();
         if (processor == null)
             processor = new DeviceProcessor();
         if (processor.Update<UserInfo>(Common.User, null))
             MessageBox.Show("Change Successfully.");
         else
             MessageBox.Show("Change Failure.");
         form.Close();
     }
 }
예제 #3
0
 private void OK()
 {
     if (Common.TextBoxChecked(this.tbPwd) && Common.TextBoxChecked(this.tbNewPwd) &&
         Common.TextBoxChecked(this.tbConfirm) && Common.PasswordConfirmed(tbNewPwd, tbConfirm))
     {
         Common.User.Pwd = this.tbNewPwd.Text.TrimEnd();
         if (processor == null)
         {
             processor = new DeviceProcessor();
         }
         if (processor.Update <UserInfo>(Common.User, null))
         {
             MessageBox.Show(Messages.ChangeNewPasswordOk, Messages.TitleNotification);
         }
         else
         {
             MessageBox.Show(Messages.ChangeNewPasswordFailed, Messages.TitleError);
         }
         form.Close();
     }
 }
예제 #4
0
        private void InitEventsForTextBoxValidation()
        {
            this.tbPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbPwd))
                {
                    //判断密钥长度
                    if (Common.Policy == null)
                    {
                        Common.ClearToolTip(this.wrongTip, this.pbPasswordTip);
                    }
                    else
                    {
                        if (tbPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                        {
                            Common.ClearToolTip(this.wrongTip, this.pbPasswordTip);
                        }
                        else
                        {
                            this.pbPasswordTip.Visible = true;
                            this.wrongTip.SetToolTip(this.pbPasswordTip, string.Format(Messages.PasswordShortThanDefined, Common.Policy.MinPwdSize));
                        }
                    }
                }
                else
                {
                    this.pbPasswordTip.Visible = true;
                    this.wrongTip.SetToolTip(this.pbPasswordTip, Messages.EmptyContentError);
                }
            });
            /*密码确认*/
            this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbConfirm))
                {
                    if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                    {
                        Common.ClearToolTip(this.wrongTip, this.pbConfirmPasswordTip);
                    }
                    else
                    {
                        this.pbConfirmPasswordTip.Visible = true;
                        this.wrongTip.SetToolTip(this.pbConfirmPasswordTip, Messages.MismatchPassword);
                    }
                }
                else
                {
                    this.pbConfirmPasswordTip.Visible = true;
                    this.wrongTip.SetToolTip(this.pbConfirmPasswordTip, Messages.EmptyContentError);
                }
            });

            this.tbFullName.Leave += new EventHandler((sender, args) => {
                if (Common.TextBoxChecked(this.tbFullName))
                {
                    Common.ClearToolTip(this.wrongTip, this.pbFullNameTip);
                }
                else
                {
                    this.pbFullNameTip.Visible = true;
                    this.wrongTip.SetToolTip(this.pbFullNameTip, Messages.EmptyContentError);
                }
            });

            this.tbDescription.Leave += new EventHandler((sender, args) =>
            {
                if (Common.TextBoxChecked(this.tbDescription))
                {
                    Common.ClearToolTip(this.wrongTip, this.pbRoleTip);
                }
                else
                {
                    this.pbRoleTip.Visible = true;
                    this.wrongTip.SetToolTip(this.pbRoleTip, Messages.EmptyContentError);
                }
            });
        }
예제 #5
0
        private void OK()
        {
            string message = this.checkAllUserInfoFields();

            if (!string.IsNullOrEmpty(message))
            {
                Utils.ShowMessageBox(message, Messages.TitleError);
                return;
            }
            if (Common.TextBoxChecked(this.tbUserName) && Common.TextBoxChecked(this.tbFullName) &&
                Common.TextBoxChecked(this.tbDescription) && Common.TextBoxChecked(this.tbPwd) &&
                Common.TextBoxChecked(this.tbConfirm) && Common.PasswordConfirmed(tbPwd, tbConfirm))
            {
                /*密钥长度*/
                if (Common.Policy == null || Common.Policy.MinPwdSize > this.tbPwd.Text.Length)
                {
                    return;
                }

                bool isChangeGroup = false, isChangePwd = false, isEditUser = false, isDisableUser = false;
                /*记录日志*/
                if (user.RoleId != Convert.ToInt32(this.cbxRole.SelectedValue))
                {
                    isChangeGroup = true;
                }
                if (user.Pwd != tbPwd.Text)
                {
                    isChangePwd = true;
                }
                if (user.Description != tbDescription.Text || user.FullName != tbFullName.Text)
                {
                    isEditUser = true;
                }
                if (isChangePwd || isChangeGroup || isEditUser || isDisableUser)
                {
                    if (username == string.Empty)
                    {
                        user.Userid = ++userid;
                    }
                    user.Account            = this.tbUserName.Text.TrimEnd();
                    user.FullName           = this.tbFullName.Text.TrimEnd();
                    user.Description        = this.tbDescription.Text.TrimEnd();
                    user.LastPwdChangedTime = this.tbPwd.Text == user.Pwd ? user.LastPwdChangedTime : DateTime.Now;
                    user.Pwd    = this.tbPwd.Text.TrimEnd();
                    user.Remark = DateTime.Now.ToString();
                    user.RoleId = this.cbxRole.SelectedValue == null ? 1 : Convert.ToInt32(this.cbxRole.SelectedValue);
                    if (processor.InsertOrUpdate <UserInfo>(user, null, username == string.Empty ? true : false))
                    {
                        Utils.ShowMessageBox(Messages.SavedSuccessfully, Messages.TitleNotification);
                        if (isChangeGroup)
                        {
                            InsertChangeLog("Change group");
                        }
                        if (isChangePwd)
                        {
                            InsertChangeLog("Change password");
                        }
                        if (isEditUser)
                        {
                            InsertChangeLog("Edit user");
                        }
                        if (isDisableUser && user.Disabled != 0)
                        {
                            InsertChangeLog("Disable user");
                        }
                        form.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        Utils.ShowMessageBox(Messages.SavedFailed, Messages.TitleError);
                        form.DialogResult = DialogResult.No;
                    }
                }
                else
                {
                    form.DialogResult = DialogResult.OK;
                }
            }
        }
예제 #6
0
        private void InitEvents()
        {
            /*关闭窗口*/
            this.btnCancel.Click += new EventHandler(delegate(object sender, EventArgs args)
            {
                this.form.Close();
            });
            this.tbPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbPwd))
                {
                    if (this.tbPwd.Text.TrimEnd() == Common.User.Pwd)
                    {
                        this.lbAlarmPwd.Text = "√ correct password.";
                    }
                    else
                    {
                        this.tbPwd.Focus();
                        this.lbAlarmPwd.Text = "x wrong password.";
                    }
                }
                else
                {
                    this.tbPwd.Focus();
                    this.lbAlarmPwd.Text = "x none content.";
                }
            });
            /*新密码校验*/
            this.tbNewPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbNewPwd))
                {
                    //判断密钥长度
                    if (Common.Policy == null)
                    {
                        this.lbAlarmNewPwd.Text = "√";
                    }
                    else
                    {
                        if (tbNewPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                        {
                            if (tbNewPwd.Text.TrimEnd() != Common.User.Pwd)
                            {
                                this.lbAlarmNewPwd.Text = "√";
                            }
                            else
                            {
                                this.lbAlarmNewPwd.Text = "x same as current.";
                                this.tbNewPwd.Focus();
                            }
                        }
                        else
                        {
                            this.lbAlarmNewPwd.Text = "x min pwd size is " + Common.Policy.MinPwdSize.ToString();
                            this.tbNewPwd.Focus();
                        }
                    }
                }
                else if (!Common.TextBoxChecked(tbNewPwd))
                {
                    this.tbNewPwd.Focus();
                    this.lbAlarmNewPwd.Text = "x none content";
                }

                if (Common.PasswordConfirmed(tbNewPwd, tbConfirm))
                {
                    this.lbAlarmConfirm.Text = "√";
                }
            });
            /*密码确认*/
            this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbConfirm))
                {
                    if (Common.PasswordConfirmed(tbNewPwd, tbConfirm))
                    {
                        this.lbAlarmConfirm.Text = "√";
                    }
                    else
                    {
                        this.lbAlarmConfirm.Text = "x confirmed failure";
                    }
                }
                else
                {
                    this.tbConfirm.Focus();
                    this.lbAlarmConfirm.Text = "x none content";
                }
            });
            /*保存修改后的密码*/
            this.btnOK.Click += new EventHandler(delegate(object sender, EventArgs args)
            {
                OK();
            });
            /*确认密码回车*/
            this.tbConfirm.KeyPress += new KeyPressEventHandler(delegate(object sender, KeyPressEventArgs args)
            {
                if (args.KeyChar == 13)
                {
                    OK();
                }
            });
        }
예제 #7
0
        private void InitEvent()
        {
            this.Load += new EventHandler(delegate(object sender, EventArgs args) { this.tbUserName.Focus(); });
            #region username
            this.tbUserName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    //判断用户名是否使用过
                    UserInfo user = processor.QueryOne <UserInfo>("select * from userinfo where username=@username", delegate()
                    {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("username", tbUserName.Text);
                        return(dic);
                    });
                    if (user.Userid == 0)
                    {
                        lbAlarmUn.Text = "√";
                    }
                    else
                    {
                        this.lbAlarmUn.Text  = "x " + tbUserName.Text + " has been used";
                        this.tbUserName.Text = "";
                        //this.tbUserName.Focus();
                    }
                }
                else
                {
                    //this.tbUserName.Focus();
                    this.lbAlarmUn.Text = "x none content";
                }
            });
            #endregion
            #region fullname
            this.tbFullName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    this.lbAlarmFN.Text = "√";
                }
                else
                {
                    //this.tbFullName.Focus();
                    this.lbAlarmFN.Text = "x none content";
                }
            });
            #endregion
            #region desc
            this.tbDescription.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbDescription))
                {
                    this.lbAlarmDesc.Text = "√";
                }
                else
                {
                    //this.tbDescription.Focus();
                    this.lbAlarmDesc.Text = "x none content";
                }
            });
            #endregion
            #region pwd
            this.tbPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbPwd))
                {
                    //判断密钥长度
                    if (Common.Policy == null)
                    {
                        this.lbAlarmPwd.Text = "√";
                    }
                    else
                    {
                        if (tbPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                        {
                            this.lbAlarmPwd.Text = "√";
                        }
                        else
                        {
                            this.lbAlarmPwd.Text = "x min pwd size is " + Common.Policy.MinPwdSize.ToString();
                            //this.tbPwd.Focus();
                        }
                    }
                }
                else if (!Common.TextBoxChecked(tbPwd))
                {
                    //this.tbPwd.Focus();
                    this.lbAlarmPwd.Text = "x none content";
                }

                if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                {
                    this.lbAlarmConfirm.Text = "√";
                }
            });
            #endregion
            #region confirm
            this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbConfirm))
                {
                    if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                    {
                        this.lbAlarmConfirm.Text = "√";
                    }
                    else
                    {
                        this.lbAlarmConfirm.Text = "x confirmed failure";
                    }
                }
                else
                {
                    //this.tbConfirm.Focus();
                    this.lbAlarmConfirm.Text = "x none content";
                }
            });
            #endregion
        }
예제 #8
0
        private void InitEvent()
        {
            this.Load += new EventHandler(delegate(object sender, EventArgs args) {
                this.tbUserName.Focus();
                if (FirstCreate)
                {
                    this.parentForm.FormTitleText = InputBoxTitle.WizardCreateAdmin;
                }
                this.rbUser.Enabled  = !FirstCreate;
                this.rbAdmin.Checked = FirstCreate;
                this.rbUser.Checked  = !FirstCreate;
            });
            #region username
            this.tbUserName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                ((TextBox)sender).Text = ((TextBox)sender).Text.Trim();
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    //判断用户名是否使用过
                    UserInfo user = processor.QueryOne <UserInfo>("select * from userinfo where username=@username COLLATE NOCASE", delegate()
                    {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("username", tbUserName.Text.Trim().ToLower());
                        return(dic);
                    });
                    if (user.Userid == 0)
                    {
                        Common.ClearToolTip(this.wrongTip, this.pbUserNameTip);
                    }
                    else
                    {
                        Common.SetToolTip(this.wrongTip, this.pbUserNameTip, Messages.UserNameOccupied);
                    }
                }
                else
                {
                    Common.SetToolTip(this.wrongTip, this.pbUserNameTip, Messages.EmptyContentError);
                }
            });
            #endregion
            #region fullname
            this.tbFullName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    Common.ClearToolTip(this.wrongTip, this.pbFullNameTip);
                }
                else
                {
                    Common.SetToolTip(this.wrongTip, this.pbFullNameTip, Messages.EmptyContentError);
                }
            });
            #endregion
            #region desc
            this.tbDescription.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbDescription))
                {
                    Common.ClearToolTip(this.wrongTip, this.pbRoleTip);
                }
                else
                {
                    Common.SetToolTip(this.wrongTip, this.pbRoleTip, Messages.EmptyContentError);
                }
            });
            #endregion
            #region pwd
            this.tbPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbPwd))
                {
                    //判断密钥长度
                    if (Common.Policy == null)
                    {
                        Common.ClearToolTip(this.wrongTip, this.pbPasswordTip);
                    }
                    else
                    {
                        if (tbPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                        {
                            Common.ClearToolTip(this.wrongTip, this.pbPasswordTip);
                        }
                        else
                        {
                            Common.SetToolTip(this.wrongTip, this.pbPasswordTip, string.Format(Messages.PasswordShortThanDefined, Common.Policy.MinPwdSize));
                        }
                    }
                }
                else
                {
                    Common.SetToolTip(this.wrongTip, this.pbPasswordTip, Messages.EmptyContentError);
                }
            });
            #endregion
            #region confirm
            this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbConfirm))
                {
                    if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                    {
                        Common.ClearToolTip(this.wrongTip, this.pbConfirmPasswordTip);
                    }
                    else
                    {
                        Common.SetToolTip(this.wrongTip, this.pbConfirmPasswordTip, Messages.MismatchPassword);
                    }
                }
                else
                {
                    Common.SetToolTip(this.wrongTip, this.pbConfirmPasswordTip, Messages.EmptyContentError);
                }
            });
            #endregion

            this.initGroupRadioCheckEvent();
            //非法字符处理事件
            this.tbUserName.TextChanged += new EventHandler((sender, e) => {
                Utils.IsInputTextValid(this.tbUserName);
            });
            this.tbFullName.TextChanged += new EventHandler((sender, e) =>
            {
                Utils.IsInputTextValid(this.tbFullName);
            });
        }
예제 #9
0
        private void InitEvents()
        {
            this.btnOK.Click += new EventHandler(delegate(object sender, EventArgs args){
                if (Common.TextBoxChecked(this.tbUserName) /*&& Common.TextBoxChecked(this.tbFullName) &&
                                                            * Common.TextBoxChecked(this.tbDescription)*/&& Common.TextBoxChecked(this.tbPwd) &&
                    Common.TextBoxChecked(this.tbConfirm) && Common.PasswordConfirmed(tbPwd, tbConfirm))
                {
                    /*密钥长度*/
                    if (Common.Policy == null || Common.Policy.MinPwdSize > this.tbPwd.Text.Length)
                    {
                        return;
                    }
                    if (username == string.Empty)
                    {
                        user.Userid = ++userid;
                    }
                    user.Account            = this.tbUserName.Text.TrimEnd();
                    user.FullName           = this.tbFullName.Text.TrimEnd();
                    user.Description        = this.tbDescription.Text.TrimEnd();
                    user.LastPwdChangedTime = this.tbPwd.Text == user.Pwd ? user.LastPwdChangedTime : DateTime.Now;
                    user.Pwd       = this.tbPwd.Text.TrimEnd();
                    user.Locked    = this.cbLocked.Checked == true ? 1 : 0;
                    user.ChangePwd = this.cbChangePwd.Checked == true ? 1 : 0;
                    user.Remark    = DateTime.Now.ToString();
                    user.RoleId    = this.cbxRole.SelectedValue == null ? 1: Convert.ToInt32(this.cbxRole.SelectedValue);
                    if (processor.InsertOrUpdate <UserInfo>(user, null, username == string.Empty ? true : false))
                    {
                        MessageBox.Show("Saved Successfully");
                        form.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show("Saved Failure");
                        form.DialogResult = DialogResult.No;
                    }
                }
            });
            this.btnCancel.Click += new EventHandler(delegate(object sender, EventArgs args){
                form.Close();
            });
            this.tbUserName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    //判断用户名是否使用过
                    UserInfo user = processor.QueryOne <UserInfo>("select * from userinfo where username=@username", delegate() {
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        dic.Add("username", tbUserName.Text);
                        return(dic);
                    });
                    if (user.Userid == 0)
                    {
                        lbAlarmUn.Text = "√";
                    }
                    else
                    {
                        this.lbAlarmUn.Text = "x " + tbUserName.Text + " has been used";
                        this.tbUserName.Focus();
                    }
                }
                else
                {
                    this.tbUserName.Focus();
                    this.lbAlarmUn.Text = "x none content";
                }
            });
            this.tbFullName.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked((TextBox)sender))
                {
                    this.lbAlarmFN.Text = "√";
                }
                else
                {
                    //this.tbFullName.Focus();
                    this.lbAlarmFN.Text = "x none content";
                }
            });
            this.tbDescription.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbDescription))
                {
                    this.lbAlarmDesc.Text = "√";
                }
                else
                {
                    //this.tbDescription.Focus();
                    this.lbAlarmDesc.Text = "x none content";
                }
            });
            this.tbPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbPwd))
                {
                    //判断密钥长度
                    if (Common.Policy == null)
                    {
                        this.lbAlarmPwd.Text = "√";
                    }
                    else
                    {
                        if (tbPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                        {
                            this.lbAlarmPwd.Text = "√";
                        }
                        else
                        {
                            this.lbAlarmPwd.Text = "x min pwd size is " + Common.Policy.MinPwdSize.ToString();
                            //this.tbPwd.Focus();
                        }
                    }
                }
                else if (!Common.TextBoxChecked(tbPwd))
                {
                    //this.tbPwd.Focus();
                    this.lbAlarmPwd.Text = "x none content";
                }

                if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                {
                    this.lbAlarmConfirm.Text = "√";
                }
            });
            this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
            {
                if (Common.TextBoxChecked(tbConfirm))
                {
                    if (Common.PasswordConfirmed(tbPwd, tbConfirm))
                    {
                        this.lbAlarmConfirm.Text = "√";
                    }
                    else
                    {
                        this.lbAlarmConfirm.Text = "x confirmed failure";
                    }
                }
                else
                {
                    //this.tbConfirm.Focus();
                    this.lbAlarmConfirm.Text = "x none content";
                }
            });
        }
예제 #10
0
 /// <summary>
 /// 初始化事件
 /// </summary>
 private void InitEvent()
 {
     /*新密码校验*/
     this.tbNewPwd.Leave += new EventHandler(delegate(object sender, EventArgs args)
     {
         if (Common.TextBoxChecked(tbNewPwd))
         {
             //判断密钥长度
             if (Common.Policy == null)
             {
                 Common.ClearToolTip(this.wrongTip, this.pbNewPasswordTip);
             }
             else
             {
                 if (tbNewPwd.Text.TrimEnd().Length >= Common.Policy.MinPwdSize)
                 {
                     if (tbNewPwd.Text.TrimEnd() != Common.User.Pwd)
                     {
                         Common.ClearToolTip(this.wrongTip, this.pbNewPasswordTip);
                     }
                     else
                     {
                         Common.SetToolTip(this.wrongTip, this.pbNewPasswordTip, Messages.NewSameOfOldWhenResetPassword);
                     }
                 }
                 else
                 {
                     Common.SetToolTip(this.wrongTip, this.pbNewPasswordTip, string.Format(Messages.PasswordShortThanDefined, Common.Policy.MinPwdSize));
                 }
             }
         }
         else if (!Common.TextBoxChecked(tbNewPwd))
         {
         }
     });
     /*密码确认*/
     this.tbConfirm.Leave += new EventHandler(delegate(object sender, EventArgs args)
     {
         if (Common.TextBoxChecked(tbConfirm))
         {
             if (Common.PasswordConfirmed(tbNewPwd, tbConfirm))
             {
                 Common.ClearToolTip(this.wrongTip, this.pbConfirmNewPasswordTip);
             }
             else
             {
                 Common.SetToolTip(this.wrongTip, this.pbConfirmNewPasswordTip, Messages.MismatchPassword);
             }
         }
         else
         {
         }
     });
     /*保存修改后的密码*/
     this.btnOK.Click += new EventHandler(delegate(object sender, EventArgs args)
     {
         OK();
     });
     /*确认密码回车*/
     this.tbConfirm.KeyPress += new KeyPressEventHandler(delegate(object sender, KeyPressEventArgs args)
     {
         if (args.KeyChar == 13)
         {
             OK();
         }
     });
     tbNewPwd.KeyPress += new KeyPressEventHandler((sender, args) =>
     {
         if (args.KeyChar == 13)
         {
             tbConfirm.Focus();
         }
     });
 }