function protected_pages_enter_password in Protected Pages 7.2
Same name and namespace in other branches
- 7 protected_pages.inc \protected_pages_enter_password()
Callback function for enter password page.
1 string reference to 'protected_pages_enter_password'
- protected_pages_menu in ./
protected_pages.module - Implements hook_menu().
File
- ./
protected_pages.inc, line 11 - Provides page callbacks for enter password page.
Code
function protected_pages_enter_password($form, &$form_state) {
if (!isset($_GET['destination']) || empty($_GET['protected_page']) || !is_numeric($_GET['protected_page'])) {
watchdog('protected_page', 'Illegal call to /protected-page', array(), WATCHDOG_WARNING);
drupal_access_denied();
exit;
}
$pid = db_select('protected_pages')
->fields('protected_pages', array(
'pid',
))
->condition('pid', $_GET['protected_page'])
->range(0, 1)
->execute()
->fetchField();
if (!$pid) {
watchdog('protected_page', 'Invalid pid (@pid) used with /protected-page', array(
'@pid' => $_GET['protected_page'],
), WATCHDOG_WARNING);
drupal_access_denied();
exit;
}
$form['protected_page_enter_password'] = array(
'#type' => 'fieldset',
'#description' => variable_get('protected_pages_description', t('The page you are trying to view is password protected. Please enter the password below to proceed.')),
'#collapsible' => FALSE,
);
$form['protected_page_enter_password']['password'] = array(
'#type' => 'password',
'#title' => variable_get('protected_pages_password_label', t('Enter Password')),
'#size' => 20,
'#required' => TRUE,
);
$form['protected_page_pid'] = array(
'#type' => 'hidden',
'#value' => $_GET['protected_page'],
);
$form['protected_page_enter_password']['submit'] = array(
'#type' => 'submit',
'#value' => variable_get('protected_pages_submit_button_text', t('Authenticate')),
);
return $form;
}