/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { var privatekey = secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(Owner, "Please enter the Secret Code"); DialogResult = DialogResult.None; return; } var first = !newAuthenticatorProgress.Visible; if (verifyAuthenticator(privatekey) == false) { DialogResult = DialogResult.None; return; } if (first) { DialogResult = DialogResult.None; return; } if (Authenticator.AuthenticatorData == null) { WinAuthForm.ErrorDialog(Owner, "Please enter the Secret Code and click Verify Authenticator"); DialogResult = DialogResult.None; } }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { var privatekey = secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(Owner, "Please enter the Secret Code"); DialogResult = DialogResult.None; return; } var first = Authenticator.AuthenticatorData == null; if (verifyAuthenticator(privatekey) == false) { DialogResult = DialogResult.None; return; } if (first) { DialogResult = DialogResult.None; return; } // if this is a htop we reduce the counter because we are going to immediate get the code and increment if (Authenticator.AuthenticatorData is HOTPAuthenticator) { ((HOTPAuthenticator)Authenticator.AuthenticatorData).Counter--; } }
/// <summary> /// Click to create a enroll a new authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void enrollAuthenticatorButton_Click(object sender, EventArgs e) { do { try { newSerialNumberField.Text = "creating..."; TrionAuthenticator authenticator = new TrionAuthenticator(); #if DEBUG authenticator.Enroll(System.Diagnostics.Debugger.IsAttached); #else authenticator.Enroll(); #endif this.Authenticator.AuthenticatorData = authenticator; newSerialNumberField.Text = authenticator.Serial; newLoginCodeField.Text = authenticator.CurrentCode; newRestoreCodeField.Text = authenticator.DeviceId; return; } catch (InvalidEnrollResponseException iere) { if (WinAuthForm.ErrorDialog(this.Owner, "An error occured while registering a new authenticator", iere, MessageBoxButtons.RetryCancel) != System.Windows.Forms.DialogResult.Retry) { break; } } } while (true); clearAuthenticator(false); }
/// <summary> /// Reject the trade Confirmation /// </summary> /// <param name="tradeId">ID of Confirmation</param> private void RejectTrade(string tradeId) { try { var trade = m_trades.Where(t => t.Id == tradeId).FirstOrDefault(); if (trade == null) { WinAuthForm.ErrorDialog(this, "Invalid trade"); return; } var result = this.AuthenticatorData.GetClient().ConfirmTrade(trade.Id, trade.Key, false); if (result == false) { WinAuthForm.ErrorDialog(this, "Trade cannot be cancelled"); } else { m_trades.Remove(trade); MetroButton button = FindControl <MetroButton>(tabs.SelectedTab, "tradeAccept_" + trade.Id); button.Visible = false; button = FindControl <MetroButton>(tabs.SelectedTab, "tradeReject_" + trade.Id); button.Visible = false; MetroLabel status = FindControl <MetroLabel>(tabs.SelectedTab, "tradeStatus_" + trade.Id); status.Text = "Cancelled"; status.Visible = true; } } catch (InvalidTradesResponseException ex) { WinAuthForm.ErrorDialog(this, "Error trying to reject trade", ex, MessageBoxButtons.OK); } }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { string privatekey = this.secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(this.Owner, "Please enter the Secret Code"); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } bool first = !newAuthenticatorProgress.Visible; if (verifyAuthenticator(privatekey) == false) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (first == true) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (this.Authenticator.AuthenticatorData == null) { WinAuthForm.ErrorDialog(this.Owner, "Please enter the Secret Code and click Verify Authenticator"); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } }
/// <summary> /// Click to create a enroll a new authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void enrollAuthenticatorButton_Click(object sender, EventArgs e) { do { try { newSerialNumberField.Text = "creating..."; BattleNetAuthenticator authenticator = new BattleNetAuthenticator(); #if DEBUG authenticator.Enroll(System.Diagnostics.Debugger.IsAttached); #else authenticator.Enroll(); #endif this.Authenticator.AuthenticatorData = authenticator; newSerialNumberField.Text = authenticator.Serial; newLoginCodeField.Text = authenticator.CurrentCode; newRestoreCodeField.Text = authenticator.RestoreCode; newAuthenticatorProgress.Visible = true; newAuthenticatorTimer.Enabled = true; return; } catch (InvalidEnrollResponseException iere) { if (WinAuthForm.ErrorDialog(this.Owner, "注册新的验证器时发生错误", iere, MessageBoxButtons.RetryCancel) != System.Windows.Forms.DialogResult.Retry) { break; } } } while (true); clearAuthenticator(false); }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { string privatekey = this.secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(this.Owner, "Please enter the Secret Code"); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } bool first = (this.Authenticator.AuthenticatorData == null); if (verifyAuthenticator(privatekey) == false) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (first == true) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } // if this is a htop we reduce the counter because we are going to immediate get the code and increment if (this.Authenticator.AuthenticatorData is HOTPAuthenticator) { ((HOTPAuthenticator)this.Authenticator.AuthenticatorData).Counter--; } }
/// <summary> /// Check the configuration with the current yubikey /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void yubikeyCheckButton_Click(object sender, EventArgs e) { if (WinAuthForm.ConfirmDialog(this, "Your YubiKey slot will now be verified. If it requires you to press the button, please press when the light starts flashing." + Environment.NewLine + Environment.NewLine + "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != System.Windows.Forms.DialogResult.Yes) { return; } int slot = (yubiSlotToggle.Checked == true ? 2 : 1); try { byte[] challenge = Encoding.ASCII.GetBytes("WinAuth"); // get the hash from the key byte[] hash = this.Yubikey.ChallengeResponse(slot, challenge); } catch (ApplicationException ex) { WinAuthForm.ErrorDialog(this, "The YubiKey test failed. Please check the configuration is for Challenge-Response in HMAC-SHA1 mode with Variable Input. (" + ex.Message + ")"); return; } YubikeySlot = slot; WinAuthForm.ErrorDialog(this, "Your YubiKey has been successfully tested."); }
/// <summary> /// Click to get they security questions /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void restoreGetQuestionsButton_Click(object sender, EventArgs e) { string email = this.restoreEmailField.Text.Trim(); string password = this.restorePasswordField.Text.Trim(); if (email.Length == 0 || password.Length == 0) { WinAuthForm.ErrorDialog(this.Owner, "Please enter your account email and password"); return; } try { string question1, question2; TrionAuthenticator.SecurityQuestions(email, password, out question1, out question2); restoreQuestion1Label.Text = question1 ?? string.Empty; restoreQuestion2Label.Text = question2 ?? string.Empty; } catch (InvalidRestoreResponseException irre) { WinAuthForm.ErrorDialog(this.Owner, irre.Message, irre); return; } catch (Exception ex) { WinAuthForm.ErrorDialog(this.Owner, "Unable to access account: " + ex.Message, ex); return; } }
/// <summary> /// Answer the captcha /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void captchaButton_Click(object sender, EventArgs e) { if (captchacodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter the characters in the image", null, MessageBoxButtons.OK); return; } Process(usernameField.Text.Trim(), passwordField.Text.Trim(), this.AuthenticatorData.GetClient().CaptchaId, captchacodeField.Text.Trim()); }
/// <summary> /// Login to steam account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loginButton_Click(object sender, EventArgs e) { if (usernameField.Text.Trim().Length == 0 || passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter your username and password", null, MessageBoxButtons.OK); return; } Process(usernameField.Text.Trim(), passwordField.Text.Trim()); }
/// <summary> /// Click verify button to load and check code /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void verifyButton_Click(object sender, EventArgs e) { string privatekey = this.secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(this.Owner, "Please enter the Secret Code"); return; } verifyAuthenticator(privatekey); }
/// <summary> /// Click to add the code /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void verifyAuthenticatorButton_Click(object sender, EventArgs e) { string privatekey = this.secretCodeField.Text.Trim(); if (string.IsNullOrEmpty(privatekey) == true) { WinAuthForm.ErrorDialog(this, "Please enter the secret code"); return; } verifyAuthenticator(privatekey); }
/// <summary> /// Confirm with the code sent by email /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void authcodeButton_Click(object sender, EventArgs e) { if (authcodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter the authorisation code"); return; } m_enroll.EmailAuthText = authcodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// OK button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { // check password is set if requried if (passwordCheckbox.Checked == true && passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, strings.EnterPassword); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (passwordCheckbox.Checked == true && string.Compare(passwordField.Text.Trim(), verifyField.Text.Trim()) != 0) { WinAuthForm.ErrorDialog(this, strings.PasswordsDontMatch); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (yubikeyBox.Checked == true && YubikeySlot == 0 && (PasswordType & (Authenticator.PasswordTypes.YubiKeySlot1 | Authenticator.PasswordTypes.YubiKeySlot2)) == 0) { WinAuthForm.ErrorDialog(this, "Please verify your YubiKey using the Use Slot or Configure Slot buttons."); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } // set the valid password type property PasswordType = Authenticator.PasswordTypes.None; Password = null; if (userCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.User; } else if (machineCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.Machine; } if (passwordCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.Explicit; if (this.passwordField.Text != EXISTING_PASSWORD) { Password = this.passwordField.Text.Trim(); } } if (yubikeyBox.Checked == true) { if (YubikeySlot == 1) { PasswordType |= Authenticator.PasswordTypes.YubiKeySlot1; } else if (YubikeySlot == 2) { PasswordType |= Authenticator.PasswordTypes.YubiKeySlot2; } } }
/// <summary> /// Confirm with the code sent by email /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void authcodeButton_Click(object sender, EventArgs e) { if (authcodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "请输入授权代码", null, MessageBoxButtons.OK); return; } m_enroll.EmailAuthText = authcodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Login to steam account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loginButton_Click(object sender, EventArgs e) { if (usernameField.Text.Trim().Length == 0 || passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter your username and password"); return; } m_enroll.Username = usernameField.Text.Trim(); m_enroll.Password = passwordField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void confirmButton_Click(object sender, EventArgs e) { if (activationcodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter the activation code from your email"); DialogResult = DialogResult.None; return; } m_enroll.ActivationCode = activationcodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Login to steam account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void loginButton_Click(object sender, EventArgs e) { if (usernameField.Text.Trim().Length == 0 || passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "请输入您的用户名和密码", null, MessageBoxButtons.OK); return; } m_enroll.Username = usernameField.Text.Trim(); m_enroll.Password = passwordField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void confirmButton_Click(object sender, EventArgs e) { if (activationcodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "请从电子邮件中输入激活码"); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } m_enroll.ActivationCode = activationcodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Import the selected SDA account /// </summary> /// <returns>true if successful</returns> private bool ImportSDA() { var entry = importSDAList.SelectedItem as ImportedSDAEntry; if (entry == null) { WinAuthForm.ErrorDialog(this, "Please load and select a Steam account"); return(false); } var auth = new SteamAuthenticator(); var token = JObject.Parse(entry.json); foreach (var prop in token.Root.Children().ToList()) { var child = token.SelectToken(prop.Path); var lkey = prop.Path.ToLower(); if (lkey == "fully_enrolled" || lkey == "session") { prop.Remove(); } else if (lkey == "device_id") { auth.DeviceId = child.Value <string>(); prop.Remove(); } else if (lkey == "serial_number") { auth.Serial = child.Value <string>(); } else if (lkey == "account_name") { if (nameField.Text.Length == 0) { nameField.Text = "Steam (" + child.Value <string>() + ")"; } } else if (lkey == "shared_secret") { auth.SecretKey = Convert.FromBase64String(child.Value <string>()); } } auth.SteamData = token.ToString(Formatting.None); Authenticator.AuthenticatorData = auth; return(true); }
/// <summary> /// Answer the captcha /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void captchaButton_Click(object sender, EventArgs e) { if (captchacodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "请在图像中输入字符", null, MessageBoxButtons.OK); return; } m_enroll.Username = usernameField.Text.Trim(); m_enroll.Password = passwordField.Text.Trim(); m_enroll.CaptchaText = captchacodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Answer the captcha /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void captchaButton_Click(object sender, EventArgs e) { if (captchacodeField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, "Please enter the characters in the image"); return; } m_enroll.Username = usernameField.Text.Trim(); m_enroll.Password = passwordField.Text.Trim(); m_enroll.CaptchaText = captchacodeField.Text.Trim(); ProcessEnroll(); }
/// <summary> /// Verify and create the authenticator if needed /// </summary> /// <returns>true is successful</returns> private bool verifyAuthenticator() { if (this.tabControl1.SelectedIndex == 0) { if (this.Authenticator.AuthenticatorData == null) { WinAuthForm.ErrorDialog(this.Owner, "You need to create an authenticator and attach it to your account"); return(false); } } else { if (restoreQuestion1Label.Text.Length == 0) { restoreGetQuestionsButton_Click(null, null); return(false); } string email = this.restoreEmailField.Text.Trim(); string password = this.restorePasswordField.Text.Trim(); string deviceId = this.restoreDeviceIdField.Text.Trim(); string answer1 = this.restoreAnswer1Field.Text; string answer2 = this.restoreAnswer2Field.Text; if (deviceId.Length == 0 || (restoreQuestion2Label.Text.Length != 0 && answer1.Length == 0) || (restoreQuestion2Label.Text.Length != 0 && answer2.Length == 0)) { WinAuthForm.ErrorDialog(this.Owner, "Please enter the device ID and answers to your secret questions"); return(false); } try { TrionAuthenticator authenticator = new TrionAuthenticator(); authenticator.Restore(email, password, deviceId, answer1, answer2); this.Authenticator.AuthenticatorData = authenticator; } catch (InvalidRestoreResponseException irre) { WinAuthForm.ErrorDialog(this.Owner, "Unable to restore the authenticator: " + irre.Message, irre); return(false); } catch (Exception ex) { WinAuthForm.ErrorDialog(this.Owner, "An error occured restoring the authenticator: " + ex.Message, ex); return(false); } } return(true); }
/// <summary> /// Verify and create the authenticator if needed /// </summary> /// <returns>true is successful</returns> private bool verifyAuthenticator() { if (this.tabControl1.SelectedIndex == 0) { if (this.Authenticator.AuthenticatorData == null) { WinAuthForm.ErrorDialog(this.Owner, "您需要创建身份验证器并将其附加到您的帐户"); return(false); } } else { if (restoreQuestion1Label.Text.Length == 0) { restoreGetQuestionsButton_Click(null, null); return(false); } string email = this.restoreEmailField.Text.Trim(); string password = this.restorePasswordField.Text.Trim(); string deviceId = this.restoreDeviceIdField.Text.Trim(); string answer1 = this.restoreAnswer1Field.Text; string answer2 = this.restoreAnswer2Field.Text; if (deviceId.Length == 0 || (restoreQuestion2Label.Text.Length != 0 && answer1.Length == 0) || (restoreQuestion2Label.Text.Length != 0 && answer2.Length == 0)) { WinAuthForm.ErrorDialog(this.Owner, "请输入设备ID和您的安全问题的答案"); return(false); } try { TrionAuthenticator authenticator = new TrionAuthenticator(); authenticator.Restore(email, password, deviceId, answer1, answer2); this.Authenticator.AuthenticatorData = authenticator; } catch (InvalidRestoreResponseException irre) { WinAuthForm.ErrorDialog(this.Owner, "无法恢复验证器: " + irre.Message, irre); return(false); } catch (Exception ex) { WinAuthForm.ErrorDialog(this.Owner, "发生恢复验证器的错误: " + ex.Message, ex); return(false); } } return(true); }
private bool RejectTrade(string tradeId) #endif { try { var trade = m_trades.Where(t => t.Id == tradeId).FirstOrDefault(); if (trade == null) { throw new ApplicationException("Invalid trade"); } #if NETFX_4 var result = await Task.Factory.StartNew <bool>((t) => { return(this.AuthenticatorData.GetClient().ConfirmTrade(((SteamClient.Confirmation)t).Id, ((SteamClient.Confirmation)t).Key, false)); }, trade); #endif #if NETFX_3 var result = this.AuthenticatorData.GetClient().ConfirmTrade(trade.Id, trade.Key, false); #endif if (result == false) { throw new ApplicationException("Trade cannot be cancelled"); } m_trades.Remove(trade); MetroButton button = FindControl <MetroButton>(tabs.SelectedTab, "tradeAccept_" + trade.Id); button.Visible = false; button = FindControl <MetroButton>(tabs.SelectedTab, "tradeReject_" + trade.Id); button.Visible = false; MetroLabel status = FindControl <MetroLabel>(tabs.SelectedTab, "tradeStatus_" + trade.Id); status.Text = "Cancelled"; status.Visible = true; return(true); } catch (InvalidTradesResponseException ex) { WinAuthForm.ErrorDialog(this, "Error trying to reject trade", ex, MessageBoxButtons.OK); return(false); } catch (ApplicationException ex) { WinAuthForm.ErrorDialog(this, ex.Message); return(false); } }
/// <summary> /// OK button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { // check password is set if requried if (passwordCheckbox.Checked == true && passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, strings.EnterPassword); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (passwordCheckbox.Checked == true && string.Compare(passwordField.Text.Trim(), verifyField.Text.Trim()) != 0) { WinAuthForm.ErrorDialog(this, strings.PasswordsDontMatch); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } // set the valid password type property PasswordType = Authenticator.PasswordTypes.None; Password = null; if (userCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.User; } else if (machineCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.Machine; } if (passwordCheckbox.Checked == true) { PasswordType |= Authenticator.PasswordTypes.Explicit; if (this.passwordField.Text != EXISTING_PASSWORD) { Password = this.passwordField.Text.Trim(); } } if (!this.autologinCheckbox.Checked) { File.Delete(WinAuthConfig.AutologinOnKeyPress_file); } else { File.WriteAllText(WinAuthConfig.AutologinOnKeyPress_file, ""); } }
/// <summary> /// OK button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { // check password is set if required if (passwordCheckbox.Checked && passwordField.Text.Trim().Length == 0) { WinAuthForm.ErrorDialog(this, strings.EnterPassword); DialogResult = DialogResult.None; return; } if (passwordCheckbox.Checked && string.Compare(passwordField.Text, verifyField.Text) != 0) { WinAuthForm.ErrorDialog(this, strings.PasswordsDontMatch); DialogResult = DialogResult.None; return; } if (pgpCheckbox.Checked && pgpField.Text.Length == 0) { WinAuthForm.ErrorDialog(this, strings.MissingPGPKey); DialogResult = DialogResult.None; return; } if (fileField.Text.Length == 0) { WinAuthForm.ErrorDialog(this, strings.MissingFile); DialogResult = DialogResult.None; return; } // set the valid password type property ExportFile = fileField.Text; if (passwordCheckbox.Checked && passwordField.Text.Length != 0) { Password = passwordField.Text; } if (pgpCheckbox.Checked && pgpField.Text.Length != 0) { PGPKey = pgpField.Text; } }
/// <summary> /// Click the OK button to verify and add the authenticator /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void okButton_Click(object sender, EventArgs e) { string privatekey = this.secretCodeField.Text.Trim(); if (privatekey.Length == 0) { WinAuthForm.ErrorDialog(this.Owner, "请输入密钥"); this.DialogResult = System.Windows.Forms.DialogResult.None; return; } bool first = !this.codeProgress.Visible; if (verifyAuthenticator(privatekey) == false) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } if (first == true) { this.DialogResult = System.Windows.Forms.DialogResult.None; return; } }
/// <summary> /// Verify and create the authenticator if needed /// </summary> /// <returns>true is successful</returns> private bool verifyAuthenticator(string privatekey) { this.Authenticator.Name = nameField.Text; try { GuildWarsAuthenticator authenticator = new GuildWarsAuthenticator(); authenticator.Enroll(privatekey); this.Authenticator.AuthenticatorData = authenticator; this.Authenticator.Name = this.nameField.Text; codeField.Text = authenticator.CurrentCode; newAuthenticatorProgress.Visible = true; newAuthenticatorTimer.Enabled = true; } catch (Exception ex) { WinAuthForm.ErrorDialog(this.Owner, "Unable to create the authenticator: " + ex.Message, ex); return(false); } return(true); }