updated core to 7.80
This commit is contained in:
11
modules/user/tests/user_flood_test.info
Normal file
11
modules/user/tests/user_flood_test.info
Normal file
@@ -0,0 +1,11 @@
|
||||
name = "User module flood control tests"
|
||||
description = "Support module for user flood control testing."
|
||||
package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2021-04-21
|
||||
version = "7.80"
|
||||
project = "drupal"
|
||||
datestamp = "1619021862"
|
18
modules/user/tests/user_flood_test.module
Normal file
18
modules/user/tests/user_flood_test.module
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Dummy module implementing hook_user_flood_control.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_user_flood_control().
|
||||
*/
|
||||
function user_flood_test_user_flood_control($ip, $username = FALSE) {
|
||||
if (!empty($username)) {
|
||||
watchdog('user_flood_test', 'hook_user_flood_control was passed username %username and IP %ip.', array('%username' => $username, '%ip' => $ip));
|
||||
}
|
||||
else {
|
||||
watchdog('user_flood_test', 'hook_user_flood_control was passed IP %ip.', array('%ip' => $ip));
|
||||
}
|
||||
}
|
@@ -5,7 +5,7 @@ version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2019-05-08
|
||||
version = "7.67"
|
||||
; Information added by Drupal.org packaging script on 2021-04-21
|
||||
version = "7.80"
|
||||
project = "drupal"
|
||||
datestamp = "1557336079"
|
||||
datestamp = "1619021862"
|
||||
|
@@ -35,7 +35,7 @@ function user_form_test_current_password($form, &$form_state, $account) {
|
||||
'#description' => t('A field that would require a correct password to change.'),
|
||||
'#required' => TRUE,
|
||||
);
|
||||
|
||||
|
||||
$form['current_pass'] = array(
|
||||
'#type' => 'password',
|
||||
'#title' => t('Current password'),
|
||||
@@ -80,3 +80,42 @@ function user_form_test_user_account_submit($form, &$form_state) {
|
||||
// test for bugs that can be triggered in contributed modules.
|
||||
$form_state['rebuild'] = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function user_form_test_form_user_pass_reset_alter(&$form, &$form_state) {
|
||||
// An unaltered form has no form values; the uid/timestmap/"confirm" are in
|
||||
// the URL arguments. (If for some reason a form_alter method needs the
|
||||
// hash, it can be retrieved from $form['#action'].)
|
||||
if (!is_numeric(arg(2)) || !is_numeric(arg(3)) || !is_string(arg(4)) || arg(4) !== 'confirm') {
|
||||
throw new Exception("Something unexpected changed in the user_pass_reset form; we are not getting the UID/timestamp/'confirm' passed anymore.");
|
||||
}
|
||||
// Use the variable system to communicate to the test code, since we don't
|
||||
// share a session with it.
|
||||
variable_set('user_test_pass_reset_form_build_' . arg(2), TRUE);
|
||||
|
||||
$form['#submit'][] = 'user_form_test_form_user_pass_reset_submit';
|
||||
// We must cache the form to ensure the form builder (user_pass_reset()) is
|
||||
// skipped when processing the submitted form, otherwise we get redirected
|
||||
// already during form build.
|
||||
$form_state['cache'] = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit function for user_pass_reset().
|
||||
*/
|
||||
function user_form_test_form_user_pass_reset_submit($form, &$form_state) {
|
||||
// On submit, the hash is in arg(4).
|
||||
if (!is_numeric(arg(2)) || !is_numeric(arg(3)) || !is_string(arg(4)) || strlen(arg(4)) < 32) {
|
||||
throw new Exception("Something unexpected changed in the user_pass_reset form; we are not getting the UID/timestamp/hash passed anymore.");
|
||||
}
|
||||
variable_set('user_test_pass_reset_form_submit_' . arg(2), TRUE);
|
||||
// Because the form does no further processing and has no redirect set,
|
||||
// drupal_redirect_form() will redirect back to ourselves
|
||||
// (user/reset/UID/TIMESTAMP/HASH/login); we will be logged in and redirected
|
||||
// while the form is built again. FYI: we cannot set $form_state['rebuild']
|
||||
// to get around the first redirect without further hacks, because then the
|
||||
// form won't pass the hash. (Our original $form_state['build_info']['args']
|
||||
// contains "confirm" for the 3rd argument.)
|
||||
}
|
||||
|
11
modules/user/tests/user_session_test.info
Normal file
11
modules/user/tests/user_session_test.info
Normal file
@@ -0,0 +1,11 @@
|
||||
name = "User module session tests"
|
||||
description = "Support module for user session testing."
|
||||
package = Testing
|
||||
version = VERSION
|
||||
core = 7.x
|
||||
hidden = TRUE
|
||||
|
||||
; Information added by Drupal.org packaging script on 2021-04-21
|
||||
version = "7.80"
|
||||
project = "drupal"
|
||||
datestamp = "1619021862"
|
29
modules/user/tests/user_session_test.module
Normal file
29
modules/user/tests/user_session_test.module
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Dummy module implementing a page callback to create an anon session.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function user_session_test_menu() {
|
||||
$items = array();
|
||||
$items['user_session_test_anon_session'] = array(
|
||||
'page callback' => 'user_session_test_anon_session',
|
||||
'access callback' => TRUE,
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback.
|
||||
*
|
||||
* Creates an anonymous user session.
|
||||
*/
|
||||
function user_session_test_anon_session() {
|
||||
$data = 'This dummy data will be stored in a user session.';
|
||||
$_SESSION[__FUNCTION__] = $data;
|
||||
return $data;
|
||||
}
|
Reference in New Issue
Block a user