Example #1
0
 private void ChangePassword_Load(object sender, EventArgs e)
 {
     TxtOldPassword.Focus();
     this.AcceptButton       = BtnUpdate;
     LblHeaderText.BackColor = Color.FromName(CmC.LblBackColor);
     LblHeaderText.Font      = new Font(CmC.LblFontStyle, CmC.LblFontSize); //, 17pt, style=Bold
     LblHeaderText.Font      = new Font(LblHeaderText.Font, FontStyle.Bold);
     LblHeaderText.ForeColor = Color.FromName(CmC.LblFontColor);
 }
Example #2
0
 private void WdwChangePassword_Loaded(object sender, RoutedEventArgs e)
 {
     if (TxtOldPassword.IsVisible)
     {
         TxtOldPassword.Focus();
     }
     else
     {
         TxtPassword.Focus();
     }
 }
 private void Init()
 {
     try
     {
         TxtTip.Text = string.Format("Change password for user {0}", CurrentApp.Session.UserInfo.Account);
         TxtOldPassword.Focus();
         ChangeLanguage();
     }
     catch (Exception ex)
     {
         ShowException(ex.Message);
     }
 }
Example #4
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnConfirm_Click(object sender, EventArgs e)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            //按旧密码查询用户
            User _user = new User().Login(Tools.MD5Encrypt32(TxtOldPassword.Text));

            if (_user.Role == 0)
            {
                if (isEnglish)
                {
                    MessageBox.Show("Wrong user name or password!", "Error");
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!", "错误");
                }
                TxtOldPassword.Clear();
                TxtOldPassword.Focus();
            }
            else if (TxtNewPassword.Text != TxtFinalPsaaword.Text)
            {
                if (isEnglish)
                {
                    MessageBox.Show("Password does not match!", "Error");
                }
                else
                {
                    MessageBox.Show("新密码两次输入不一致!", "错误");
                }

                TxtNewPassword.Clear();
                TxtFinalPsaaword.Clear();
                TxtNewPassword.Focus();
            }
            else if (TxtNewPassword.Text == TxtFinalPsaaword.Text)
            {
                User _userpwd = new User();
                _userpwd.UserName = _user.UserName;
                _userpwd.PassWord = Tools.MD5Encrypt32(TxtNewPassword.Text);
                _user.ChangePassWord(_userpwd);
                if (isEnglish)
                {
                    MessageBox.Show("Success! Please login with new password!", "OK");
                }
                else
                {
                    MessageBox.Show("修改成功,请使用新密码登录!", "成功");
                }
                this.Close();
            }
            else
            {
                if (isEnglish)
                {
                    MessageBox.Show("Modification failed!");
                }
                else
                {
                    MessageBox.Show("修改失败!");
                }
            }
        }