function drupal_commons_config_password in Drupal Commons 6
Same name and namespace in other branches
- 6.2 drupal_commons.profile \drupal_commons_config_password()
Configure password policy
1 string reference to 'drupal_commons_config_password'
- drupal_commons_profile_tasks in ./
drupal_commons.profile - Perform any final installation tasks for this profile.
File
- ./
drupal_commons.profile, line 282
Code
function drupal_commons_config_password() {
// Add the password policy
$policy = new stdClass();
$policy->pid = 1;
$policy->name = st('Constraints');
$policy->description = st('Default list of password constraints');
$policy->enabled = 1;
$policy->policy = array(
'alphanumeric' => 7,
// Contain at least 7 alphanumeric chars
'username' => 1,
// Must not equal the username
'length' => 7,
// Must be longer than 7 chars
'punctuation' => 0,
);
$policy->policy = serialize($policy->policy);
$policy->created = time();
drupal_write_record('password_policy', $policy);
// Attach the policy to the authenticated user role
$policy_role = new stdClass();
$policy_role->rid = 2;
$policy_role->pid = $policy->pid;
drupal_write_record('password_policy_role', $policy_role);
// Make the restrictions visible when changing your password
variable_set('password_policy_show_restrictions', 1);
}