public void EnablePasswordProtectBookmarks(string verifiedPassword) { if (verifiedPassword != null) { PasswordProtectBookmarks = true; PasswordDerivedString = GeneralConverters.GeneratePasswordDerivedString(verifiedPassword); } }
private void HandleOkClick() { if (this.UseDerivedPassword && this.PasswordDerivedString != GeneralConverters.GeneratePasswordDerivedString(this.txtPassword.Text)) { MessageBox.Show(this, "Invalid password"); return; } this.PasswordString = this.txtPassword.Text; this.PasswordVerified = true; DialogResult = DialogResult.OK; this.Close(); }
private void HandleOkClick() { if (UsePasswordValidation && PasswordDerivedString != GeneralConverters.GeneratePasswordDerivedString(PasswordSalt + txtPassword.Text + PasswordSalt)) { MessageBox.Show(this, "Invalid password"); return; } PasswordString = txtPassword.Text; PasswordVerified = true; DialogResult = DialogResult.OK; Close(); }
private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e) { var frmsetPassword = new FormSetPassword { Text = "Choose a new password" }; if (frmsetPassword.ShowDialog(this) != DialogResult.OK) { return; } string password = frmsetPassword.VerifiedPassword; _passwordStorage.Set(PwdKey, password); _memoStorageService.SaveTabPageCollection(_tabPageDataCollection, password); _appSettingsService.Settings.PasswordDerivedString = GeneralConverters.GeneratePasswordDerivedString(_appSettingsService.Settings.ApplicationSaltValue + password + _appSettingsService.Settings.ApplicationSaltValue); _appSettingsService.SaveSettings(); UpdateApplicationState(); }
private void createNewDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { if ( MessageBox.Show(this, "Do you want to create a new Memo database? Doing so will overwrite any existing stored database under this account.", "Create new database?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } var frmSetPassword = new FormSetPassword { Text = "Choose password" }; if (frmSetPassword.ShowDialog(this) != DialogResult.OK) { return; } string password = frmSetPassword.VerifiedPassword; if (string.IsNullOrEmpty(password)) { MessageBox.Show(this, "Password can not be empty!", Resources.FormMain__ErrorText, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _passwordStorage.Set(PwdKey, password); _logicManager.CreateNewDatabase(); _appSettingsService.Settings.PasswordDerivedString = GeneralConverters.GeneratePasswordDerivedString(_appSettingsService.Settings.ApplicationSaltValue + password + _appSettingsService.Settings.ApplicationSaltValue); _appSettingsService.SaveSettings(); InitializeTabControls(); _applicationState.DatabaseLoaded = true; _applicationState.DatabaseExists = true; UpdateApplicationState(); }