Ejemplo n.º 1
0
 private void btnVerifyCode_Click(object sender, EventArgs e)
 {
     if (!_initialized)
     {
         return;
     }
     OTPVerificationCompleted = _timeAuthenticator.CheckCode(_googleAuthenticator.Secret, txtOTPCodeToVerify.Text);
     if (OTPVerificationCompleted)
     {
         txtVerifyResult.Text = "Code verified successfully";
         if (CodeVerified != null)
         {
             CodeVerified.Invoke(this, new EventArgs());
         }
     }
     else
     {
         txtVerifyResult.Text = "The code is incorrect";
     }
 }
Ejemplo n.º 2
0
        private void btnVerifyCode_Click(object sender, EventArgs e)
        {
            if (!_initialized)
            {
                return;
            }
            OTPVerificationCompleted = _timeAuthenticator.CheckCode(_googleAuthenticator.Secret, txtOTPCodeToVerify.Text);
            if (OTPVerificationCompleted)
            {
                txtVerifyResult.Text = "Code verified successfully";
                CodeVerified?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                txtVerifyResult.Text = "The code is incorrect";
                CodeVerificationFailed?.Invoke(this, EventArgs.Empty);
            }

#if _SHOW_FULL_DATE_TIME_
            txtVerifyResult.Text += $"\r\n{DateTime.Now:yyyy-MM-dd / HH:mm:ss}";
#else
            txtVerifyResult.Text += $"\r\n{DateTime.Now:HH:mm:ss}";
#endif
        }