private void butOK_Click(object sender, EventArgs e)
        {
            if (textLogOffAfterMinutes.Text != "")
            {
                try {
                    int logOffMinutes = Int32.Parse(textLogOffAfterMinutes.Text);
                    if (logOffMinutes < 0)                   //Automatic log off must be a positive numerical value.
                    {
                        throw new Exception();
                    }
                }
                catch {
                    MsgBox.Show(this, "Log off after minutes is invalid.");
                    return;
                }
            }
            DataValid.SetInvalid(InvalidType.Security);
            bool invalidatePrefs = false;

            if (            //Prefs.UpdateBool(PrefName.PasswordsMustBeStrong,checkPasswordsMustBeStrong.Checked) //handled when box clicked.
                Prefs.UpdateBool(PrefName.TimecardSecurityEnabled, checkTimecardSecurityEnabled.Checked)
                | Prefs.UpdateBool(PrefName.TimecardUsersDontEditOwnCard, checkCannotEditOwn.Checked)
                | Prefs.UpdateBool(PrefName.SecurityLogOffWithWindows, checkLogOffWindows.Checked)
                | Prefs.UpdateBool(PrefName.UserNameManualEntry, checkUserNameManualEntry.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsStrongIncludeSpecial, checkPasswordsStrongIncludeSpecial.Checked)
                | Prefs.UpdateBool(PrefName.PasswordsWeakChangeToStrong, checkPasswordForceWeakToStrong.Checked)
                | Prefs.UpdateInt(PrefName.SecurityLogOffAfterMinutes, PIn.Int(textLogOffAfterMinutes.Text))
                | Prefs.UpdateString(PrefName.DomainLoginPath, PIn.String(textDomainLoginPath.Text))
                | Prefs.UpdateString(PrefName.DomainLoginPath, textDomainLoginPath.Text)
                | Prefs.UpdateString(PrefName.DomainLoginPath, textDomainLoginPath.Text)
                | Prefs.UpdateBool(PrefName.DomainLoginEnabled, checkDomainLoginEnabled.Checked)
                | Prefs.UpdateLong(PrefName.DefaultUserGroup, comboGroups.SelectedIndex == -1?0:comboGroups.GetSelected <UserGroup>().UserGroupNum)
                | Prefs.UpdateBool(PrefName.SecurityLogOffAllowUserOverride, checkAllowLogoffOverride.Checked)
                )
            {
                invalidatePrefs = true;
            }
            //if PasswordsMustBeStrong was unchecked, then reset the strong password flags.
            if (Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, checkPasswordsMustBeStrong.Checked) && !checkPasswordsMustBeStrong.Checked)
            {
                invalidatePrefs = true;
                Userods.ResetStrongPasswordFlags();
            }
            if (checkDisableBackupReminder.Checked)
            {
                invalidatePrefs |= Prefs.UpdateDateT(PrefName.BackupReminderLastDateRun, DateTime.MaxValue.AddMonths(-1));              //if MaxValue, gives error on startup.
            }
            else
            {
                invalidatePrefs |= Prefs.UpdateDateT(PrefName.BackupReminderLastDateRun, DateTimeOD.Today);
            }
            if (invalidatePrefs)
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            DialogResult = DialogResult.OK;
        }
Beispiel #2
0
 private void checkPasswordsMustBeStrong_Click(object sender, EventArgs e)
 {
     if (checkPasswordsMustBeStrong.Checked)
     {
         Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, true);
         DataValid.SetInvalid(InvalidType.Prefs);
     }
     else             //unchecking the box
     {
         if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Warning.  If this box is unchecked, the strong password flag on all users will be reset.  If strong passwords are again turned on later, then each users will have to edit their password in order to cause the strong password flag to be set again."))
         {
             checkPasswordsMustBeStrong.Checked = true;                  //recheck it.
             return;
         }
         Userods.ResetStrongPasswordFlags();
         Prefs.UpdateBool(PrefName.PasswordsMustBeStrong, false);
         DataValid.SetInvalid(InvalidType.Security, InvalidType.Prefs);
         FillUsers();
         FillTreePerm();
     }
 }