private void btn_accept_Click(object sender, EventArgs e) { if (SkipAuth) { Result = true; Close(); } bool res = PasswordTools.Check(tbox_pass.Text); if (res) { Result = true; Close(); } else { Result = false; TryCount++; label1.Text = "WRONG PASSWORD"; label1.ForeColor = Color.Red; tbox_pass.Text = ""; } if (TryCount > 3) { label1.Text = "ACCESS DENIED"; tbox_pass.ReadOnly = true; btn_accept.Enabled = false; Result = false; } }
private void btn_change_Click(object sender, EventArgs e) { if (tbox_pass.Text != tbox_rpass.Text) { MessageBox.Show("Password didn't match"); return; } PasswordTools.SetPassword(tbox_pass.Text); var v = PasswordTools.Check(tbox_pass.Text); if (v) { MessageBox.Show("Complete"); Close(); } else if (Try > 5) { MessageBox.Show("ERROR: CRITICAL ERROR FOUND. USE PASSWORD RESCUE TOOL."); return; } else { btn_change_Click(null, null); } }
private void AskPassword_Load(object sender, EventArgs e) { Random rnd = new Random(); string uid = "OneTimeUser" + rnd.Next(0, int.MaxValue).ToString().PadLeft(10, '0'); if (!PasswordTools.IsPasswordSet()) { Result = true; label1.Visible = false; tbox_pass.Visible = false; SkipAuth = true; } tbox_uid.Text = uid; }