Ejemplo n.º 1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            string str = CryptoIO.MD5Encrypt(this.txtPwd.Text);

            if (Global.GlobalAccount.Password.Equals(str))
            {
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
            this.Count++;
            this.txtPwd.Text = string.Empty;
            this.txtPwd.Select();
            if (this.Count > 3)
            {
                this.CancelPwd();
            }
        }
Ejemplo n.º 2
0
        private void btn_ChangePwd_Click(object sender, EventArgs e)
        {
            Guid id   = Global.GlobalAccount.Id;
            bool flag = false;

            if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("msg_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
            }
            else if (!Utility.CheckPassword(this.txtPwd1.Text))
            {
                MessageBox.Show(this, Utility.PwdMsg, "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
                return;
            }
            if (string.IsNullOrEmpty(this.txtPwd1.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdEmpty", "Password cannot be empty."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
                return;
            }
            if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.txtPwd1.Select();
                return;
            }
            using (RPM_Account rPMAccount = new RPM_Account())
            {
                string str  = CryptoIO.MD5Encrypt(this.txtPwd1.Text);
                string str1 = CryptoIO.MD5Encrypt(this.txtOldPwd.Text);
                flag = rPMAccount.UpdatePassword(id, str1, str);
            }
            if (!flag)
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdNotChanged", "Password NOT changed. Please check old password."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            MessageBox.Show(this, LangCtrl.GetString("txt_PwdChanged", "Password changed."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            FormCtrl.ClearForm(this.MainPanel);
        }
Ejemplo n.º 3
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
     {
         MessageBox.Show(this, LangCtrl.GetString("msg_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.txtPwd1.Select();
         return;
     }
     if (!Utility.CheckPassword(this.txtPwd1.Text))
     {
         MessageBox.Show(this, Utility.PwdMsg, "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.txtPwd1.Select();
         return;
     }
     if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text) || string.IsNullOrEmpty(this.txtPwd1.Text))
     {
         MessageBox.Show(this, "Password Error", "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         vTextBox _vTextBox  = this.txtPwd1;
         vTextBox _vTextBox1 = this.txtPwd2;
         string   empty      = string.Empty;
         string   str        = empty;
         _vTextBox1.Text = empty;
         _vTextBox.Text  = str;
         this.txtPwd1.Select();
     }
     else if (this.AccountID != Guid.Empty)
     {
         string str1 = CryptoIO.MD5Encrypt(this.txtPwd1.Text);
         using (RPM_Account rPMAccount = new RPM_Account())
         {
             Account account = rPMAccount.GetAccount(this.AccountID);
             account.Password   = str1;
             account.IsPwdReset = new bool?(false);
             rPMAccount.InsertUpdate(account);
             rPMAccount.Save();
         }
         base.DialogResult = DialogResult.OK;
         base.Close();
         return;
     }
 }
Ejemplo n.º 4
0
 private void AppLogin()
 {
     try
     {
         this.lbl_loginMsg.Text = LangCtrl.GetString("lbl_loginMsg", "Authenticating login...");
         this.lbl_loginMsg.Refresh();
         this.TryCount++;
         if (this.TryCount >= this.MaxTrys)
         {
             Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.LOGON_COUNT, this.vTextBox_0.Text, Guid.Empty);
             Process.GetCurrentProcess().Kill();
             base.DialogResult = DialogResult.Cancel;
             base.Close();
         }
         else
         {
             this.Cursor = Cursors.WaitCursor;
             using (RPM_Account rPMAccount = new RPM_Account())
             {
                 Account account = rPMAccount.Authenticate(vTextBox_0.Text, CryptoIO.MD5Encrypt(this.txtPwd.Text));
                 if (account == null)
                 {
                     Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.LOGON_FAILED, this.vTextBox_0.Text, Guid.Empty);
                 }
                 else
                 {
                     Global.LoginIDName   = (this.vTextBox_0.Text);
                     Global.GlobalAccount = account;
                     Global.RightsProfile = account.ApplicationRights;
                     this.Cursor          = Cursors.Default;
                     base.DialogResult    = DialogResult.OK;
                     if (account.IsPwdReset.Value)
                     {
                         PwdReset pwdReset = new PwdReset()
                         {
                             AccountID = account.Id
                         };
                         if (pwdReset.ShowDialog(this) == DialogResult.Cancel)
                         {
                             Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.PASSWORD, string.Concat("Password reset canceled: ", this.vTextBox_0.Text), account.Id);
                             base.DialogResult = DialogResult.Cancel;
                             base.Close();
                         }
                         Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.PASSWORD, string.Concat("Password reset: ", this.vTextBox_0.Text), account.Id);
                     }
                     base.DialogResult = DialogResult.OK;
                     base.Close();
                 }
             }
             this.Cursor = Cursors.Default;
         }
     }
     catch (Exception exception)
     {
     }
     if (!Global.LockLogin)
     {
         this.vTextBox_0.Text = string.Empty;
     }
     this.lbl_loginMsg.Text = string.Empty;
     this.txtPwd.Text       = string.Empty;
     this.vTextBox_0.Select();
     this.Cursor = Cursors.Default;
 }