diff --git a/src/Form/AdminForm.php b/src/Form/AdminForm.php index 30a7ca3..0b510fb 100644 --- a/src/Form/AdminForm.php +++ b/src/Form/AdminForm.php @@ -118,9 +118,12 @@ class AdminForm extends FormBase { ); } + $selected_roles = array_column($this->configFactory->get('force_password_change.settings')->get('roles_change_password'), 'rid'); + $form['roles'] = [ '#type' => 'checkboxes', '#options' => $roles, + '#default_value' => $selected_roles, '#title' => $this->t('Force users in the following roles to change their password'), '#description' => $this->t('Users will be forced to change their password either on their next page load, or on their next login, depending on the setting in "Check for pending password change". If pending password changes are checked on every page load, logged in users will be forced to immediately change their password, and after changing it will be redirected back to the page they were attempting to access.') . '
' . $this->t('Note: When you return to this page, no roles will be selected. This is because this setting is a trigger, not a persistant state.'), ];