function protected_node_action_reset_passwords in Protected Node 7
Same name and namespace in other branches
- 6 protected_node.settings.inc \protected_node_action_reset_passwords()
- 1.0.x protected_node.settings.inc \protected_node_action_reset_passwords()
Reset all the passwords.
This function assigns the specified password to all the existing protected nodes.
1 string reference to 'protected_node_action_reset_passwords'
- protected_node_admin_settings in ./
protected_node.settings.inc - Define the settings form.
File
- ./
protected_node.settings.inc, line 850 - Configuration file for the protected_node module.
Code
function protected_node_action_reset_passwords($form, &$form_state) {
$passwd = $form_state['values']['protected_node_reset_passwords_password'];
if ($passwd) {
db_update('protected_nodes')
->fields(array(
'protected_node_passwd' => hash('sha256', $passwd),
))
->execute();
variable_set('protected_node_session_timelimit', REQUEST_TIME);
drupal_set_message(t('All protected nodes are now publicly visible unless protected by another module.'));
}
else {
form_error($form['protected_node_actions']['protected_node_reset_passwords']['protected_node_reset_passwords_password'], t('Enter a new password to reset all the protected node passwords.'));
}
}