private void BtnSubmit_Click(object sender, EventArgs e) { if (InputAccountId.Text.Length < 1) { return; } if (InputAccountPassword.Text.Length < 1) { return; } if (CheckAccountIsLocked(InputAccountId.Text)) { return; } CreateHashAndValidate hashFunctions = new CreateHashAndValidate(); bool result = hashFunctions.CheckPassword(InputAccountPassword.Text, InputAccountId.Text); if (!result) { if (!LoginAttemptTimer.Enabled) { LoginAttemptTimer.Start(); } if (loginAttemptCount >= 3) { TextError.Text = "Hesabınız kilitlendi. Lütfen 24 saat sonra tekrar deneyiniz"; TextError.Visible = true; SaveLockedAccount(InputAccountId.Text); return; } loginAttemptCount++; TextRemainingAttempt.Text = $"Kalan deneme hakkı:{3 - loginAttemptCount}"; TextError.Text = "Hatalı Hesap no veya Parola"; TextError.Visible = true; } else { TextError.Visible = false; loginAttemptCount = 0; LoginAttemptTimer.Stop(); AccountForm accountForm = new AccountForm { AccountId = InputAccountId.Text, LoginFormRef = this }; accountForm.Show(); this.Hide(); } }
private void TimerEventProcessor(Object myObject, EventArgs myEventArgs) { loginAttemptCount = 0; LoginAttemptTimer.Stop(); }