uppdated modules

This commit is contained in:
Bachir Soussi Chiadmi
2017-01-22 16:19:36 +01:00
parent 03be8f82aa
commit 8416e3eea1
748 changed files with 32317 additions and 20900 deletions
View File
View File
View File
@@ -6,61 +6,256 @@
*/
/**
* List destination rules.
* Form for editing an entire login destination at once.
*
* Shows list of all login destination.
*/
function login_destination_overview() {
function login_destination_overview_form($form, &$form_state) {
// Get all login destination rules from the database.
$result = db_select('login_destination', 'l')
->fields('l', array(
'id',
'triggers',
'roles',
'pages_type',
'pages',
'destination',
'weight',
'enabled',
))
->orderBy('weight')
->execute()
->fetchAll();
$form['#tree'] = TRUE;
// Loop through the categories and add them to the table.
foreach ($result as $data) {
$triggers = array_map('check_plain', unserialize($data->triggers));
if (empty($triggers)) {
$triggers = array();
}
$roles = array_map('check_plain', unserialize($data->roles));
if (empty($roles)) {
$roles = array();
}
$form[$data->id]['destination']['#markup'] = theme('login_destination_destination', array('destination' => $data->destination));
$form[$data->id]['triggers']['#markup'] = theme('login_destination_triggers', array('items' => $triggers));
$form[$data->id]['pages']['#markup'] = theme('login_destination_pages', array(
'pages' => $data->pages,
'pages_type' => $data->pages_type,
));
$form[$data->id]['roles']['#markup'] = theme('login_destination_roles', array('items' => $roles));
$form[$data->id]['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#delta' => 50,
'#default_value' => $data->weight,
'#title_display' => 'invisible',
);
$form[$data->id]['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled'),
'#default_value' => $data->enabled,
'#title_display' => 'invisible',
);
// Build a list of operations.
$operations = array();
$operations['edit'] = array(
'#type' => 'link',
'#title' => t('edit'),
'#href' => 'admin/config/people/login-destination/edit/' . $data->id,
);
$operations['delete'] = array(
'#type' => 'link',
'#title' => t('delete'),
'#href' => 'admin/config/people/login-destination/delete/' . $data->id,
);
$form[$data->id]['operations'] = $operations;
}
if (element_children($form)) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
}
else {
$form['#empty_text'] = t('There is no Login Destination Rule.');
}
return $form;
}
/**
* Returns HTML for a login destination list.
*
* @param array $variables
* An associative array containing:
* - form: A render element representing the form.
*
* @ingroup themeable
*
* @return string
*/
function theme_login_destination_overview_form($variables) {
$form = $variables['form'];
drupal_add_tabledrag('login-destination-overview', 'order', 'sibling', 'login-destination-weight');
$header = array(
t('Destination'),
t('Triggers'),
t('Pages'),
t('Roles'),
array('data' => t('Operations'), 'colspan' => 2),
array('data' => t('Enabled'), 'class' => array('checkbox')),
t('Weight'),
array('data' => t('Operations'), 'colspan' => '2'),
);
$rows = array();
foreach (element_children($form) as $ldid) {
if (!isset($form[$ldid]['enabled'])) {
continue;
}
$element = &$form[$ldid];
$operations = array();
// Get all login destination rules from the database.
$result = db_select('login_destination', 'l')
->fields('l', array('id', 'triggers', 'roles', 'pages_type', 'pages', 'destination'))
->orderBy('weight')
->execute()
->fetchAll();
foreach (element_children($element['operations']) as $op) {
$operations[] = array(
'data' => drupal_render($element['operations'][$op]),
'class' => array('login-destination-operations'),
);
}
while (count($operations) < 2) {
$operations[] = '';
}
// Loop through the categories and add them to the table.
foreach ($result as $data) {
$row = array();
$row[] = drupal_render($element['destination']);
$row[] = drupal_render($element['triggers']);
$row[] = drupal_render($element['pages']);
$row[] = drupal_render($element['roles']);
$row[] = array(
'data' => drupal_render($element['enabled']),
'class' => array(
'checkbox',
'login-destination-enabled',
),
);
$triggers = array_map('check_plain', unserialize($data->triggers));
if (empty($triggers))
$triggers = array();
$form[$ldid]['weight']['#attributes']['class'] = array('login-destination-weight');
$roles = array_map('check_plain', unserialize($data->roles));
if (empty($roles))
$roles = array();
$row[] = drupal_render($element['weight']);
$row = array_merge($row, $operations);
$row = array_merge(array('data' => $row), array());
$row['class'][] = 'draggable';
$rows[] = $row;
}
$output = '';
if (empty($rows)) {
$rows[] = array(
theme('login_destination_destination', array('destination' => $data->destination)),
theme('login_destination_triggers', array('items' => $triggers)),
theme('login_destination_pages', array('pages' => $data->pages, 'pages_type' => $data->pages_type)),
theme('login_destination_roles', array('items' => $roles)),
l(t('Edit'), 'admin/config/people/login-destination/edit/' . $data->id),
l(t('Delete'), 'admin/config/people/login-destination/delete/' . $data->id),
array(
'data' => $form['#empty_text'],
'colspan' => '7',
),
);
}
if (!$rows) {
$rows[] = array(array(
'data' => t('No rules available.'),
'colspan' => 6,
));
}
$build['login-destination_table'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
$table_arguments = array(
'header' => $header,
'rows' => $rows,
'attributes' => array(
'id' => 'login-destination-overview',
),
);
return $build;
$output .= theme('table', $table_arguments);
$output .= drupal_render_children($form);
return $output;
}
/**
* Submit handler for the login destination overview form.
*
* This function update the login destination rule attribute
* like rules are enabled/disabled or its weight.
*
* @see login_destination_overview_form()
*/
function login_destination_overview_form_submit($form, &$form_state) {
$element = &$form_state['values'];
foreach (element_children($element) as $ldid) {
if (isset($form[$ldid]['enabled'])) {
$login_destination_rules[$ldid] = $element[$ldid];
$login_destination_rules[$ldid]['ldid'] = $ldid;
}
}
foreach ($login_destination_rules as $ldid => $login_destination_rule) {
_login_destination_update_rules($login_destination_rule);
}
drupal_set_message(t('Your configuration has been saved.'), 'status');
}
/**
* Save all our changed items to the database.
*
* @param array $login_destination_rule
* An associative array representing a login destination item:
* - enabled: (required) can contain 0 or 1, if rule is enabled then
* it should be 1 else 0.
* - weight: (required) can contain any integer value.
*
* @return bool
* The ldid of the saved login destination rule, or FALSE
* if the login destination rule could not be saved.
*/
function _login_destination_update_rules($login_destination_rule) {
if (!(isset($login_destination_rule['enabled']) &&
isset($login_destination_rule['weight']) &&
isset($login_destination_rule['ldid']))
) {
return FALSE;
}
if ($login_destination_rule['enabled'] != 0 &&
$login_destination_rule['enabled'] != 1
) {
return FALSE;
}
$login_destination_rule['weight'] = (int) $login_destination_rule['weight'];
if (!is_int($login_destination_rule['weight'])) {
return FALSE;
}
db_update('login_destination')
->fields(array(
'enabled' => $login_destination_rule['enabled'],
'weight' => $login_destination_rule['weight'],
))
->condition('id', $login_destination_rule['ldid'])
->execute();
return $login_destination_rule['ldid'];
}
/**
* Render a destination of login destination rule.
*/
function theme_login_destination_destination($variables) {
$output = nl2br(check_plain($variables['destination']));
@@ -71,6 +266,9 @@ function theme_login_destination_destination($variables) {
return $output;
}
/**
* Render a trigger of login destination rule.
*/
function theme_login_destination_triggers($variables) {
$items = array_map('check_plain', $variables['items']);
@@ -82,10 +280,11 @@ function theme_login_destination_triggers($variables) {
foreach ($items as &$item) {
switch ($item) {
case 'login':
$item = 'Login';
$item = t('Login');
break;
case 'logout':
$item = 'Logout';
$item = t('Logout');
break;
}
$output .= $item . "<br/>";
@@ -94,9 +293,12 @@ function theme_login_destination_triggers($variables) {
return $output;
}
/**
* Render a page type of login destination rule.
*/
function theme_login_destination_pages($variables) {
$type = $variables['pages_type'];
if ($type == LOGIN_DESTINATION_REDIRECT_PHP) {
return nl2br(check_plain($variables['pages']));
}
@@ -120,11 +322,14 @@ function theme_login_destination_pages($variables) {
$output .= "~ ";
}
$output .= $page . "<br/>";
}
}
return $output;
}
/**
* Render a roles of login destination rule.
*/
function theme_login_destination_roles($variables) {
$items = array_values(array_intersect_key(_login_destination_role_options(), $variables['items']));
@@ -139,7 +344,7 @@ function theme_login_destination_roles($variables) {
* Category edit page.
*/
function login_destination_edit_form($form, &$form_state, array $rule = array()) {
// default values
// Default values.
$rule += array(
'triggers' => array(),
'roles' => array(),
@@ -167,18 +372,28 @@ function login_destination_edit_form($form, &$form_state, array $rule = array())
}
else {
$options = array(
LOGIN_DESTINATION_STATIC => t('Internal page or external URL'),
);
$description = t("Specify page by using its path. Example path is %blog for the blog page. %front is the front page. %current is the current page. Precede with http:// for an external URL. Leave empty to redirect to a default page.", array('%blog' => 'blog', '%front' => '<front>', '%current' => '<current>'));
LOGIN_DESTINATION_STATIC => t('Internal page or external URL'),
);
$description = t("Specify page by using its path. Example path is %blog for the blog page. %front is the front page. %current is the current page. Precede with http:// for an external URL. Leave empty to redirect to a default page.", array(
'%blog' => 'blog',
'%front' => '<front>',
'%current' => '<current>',
));
if (module_exists('php') && $access) {
if ($access && module_exists('php')) {
$options += array(LOGIN_DESTINATION_SNIPPET => t('Page returned by this PHP code (experts only)'));
$description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. It should return either a string value or an array of params that the %function function will understand, e.g. %example. For more information, see the online API entry for <a href="@url">url function</a>. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>', '%function' => 'url($path = \'\', array $options = array())', '%example' => '<?php return array(\'blog\', array(\'fragment\' => \'overlay=admin/config\', ), ); ?>', '@url' => 'http://api.drupal.org/api/drupal/includes--common.inc/function/url/7'));
$description .= ' ' .
t('If the PHP option is chosen, enter PHP code between %php. It should return either a string value or an array of params that the %function function will understand, for example. %example. For more information, see the online API entry for <a href="@url">url function</a>. Note that executing incorrect PHP code can break your Drupal site.', array(
'%php' => '<?php ?>',
'%function' => 'url($path = \'\', array $options = array())',
'%example' => '<?php return array(\'blog\', array(\'fragment\' => \'overlay=admin/config\', ), ); ?>',
'@url' => 'http://api.drupal.org/api/drupal/includes--common.inc/function/url/7',
));
}
$form['destination_type'] = array(
'#type' => 'radios',
'#title' => 'Redirect to page',
'#title' => t('Redirect to page'),
'#default_value' => $type,
'#options' => $options,
);
@@ -197,9 +412,12 @@ function login_destination_edit_form($form, &$form_state, array $rule = array())
$form['triggers'] = array(
'#type' => 'checkboxes',
'#title' => t('Redirect upon triggers'),
'#options' => array('login' => 'Login, registration, one-time login link', 'logout' => 'Logout'),
'#options' => array(
'login' => t('Login, registration, one-time login link'),
'logout' => t('Logout'),
),
'#default_value' => $triggers,
'#description' => 'Redirect only upon selected trigger(s). If you select no triggers, all of them will be used.',
'#description' => t('Redirect only upon selected trigger(s). If you select no triggers, all of them will be used.'),
);
$type = $rule['pages_type'];
@@ -216,14 +434,22 @@ function login_destination_edit_form($form, &$form_state, array $rule = array())
}
else {
$options = array(
LOGIN_DESTINATION_REDIRECT_NOTLISTED => t('All pages except those listed'),
LOGIN_DESTINATION_REDIRECT_LISTED => t('Only the listed pages'),
);
$description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page. %login is the login form. %register is the registration form. %reset is the one-time login (e-mail validation).", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>', '%login' => 'user', '%register' => 'user/register', '%reset' => 'user/*/edit'));
LOGIN_DESTINATION_REDIRECT_NOTLISTED => t('All pages except those listed'),
LOGIN_DESTINATION_REDIRECT_LISTED => t('Only the listed pages'),
);
$description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page. %login is the login form. %register is the registration form. %reset is the one-time login (e-mail validation).", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
'%login' => 'user',
'%register' => 'user/register',
'%reset' => 'user/*/edit',
));
if (module_exists('php') && $access) {
if ($access && module_exists('php')) {
$options += array(LOGIN_DESTINATION_REDIRECT_PHP => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'));
$description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'));
$description .= ' ' .
t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'));
}
$form['pages_type'] = array(
@@ -249,14 +475,7 @@ function login_destination_edit_form($form, &$form_state, array $rule = array())
'#title' => t('Redirect users with roles'),
'#options' => _login_destination_role_options(),
'#default_value' => $default_role_options,
'#description' => 'Redirect only the selected role(s). If you select no roles, all users will be redirected.',
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $rule['weight'],
'#description' => t('When evaluating login destination rules, those with lighter (smaller) weights get evaluated before rules with heavier (larger) weights.'),
'#description' => t('Redirect only the selected role(s). If you select no roles, all users will be redirected.'),
);
$form['actions'] = array('#type' => 'actions');
@@ -279,6 +498,26 @@ function login_destination_edit_form($form, &$form_state, array $rule = array())
* Validate the contact category edit page form submission.
*/
function login_destination_edit_form_validate($form, &$form_state) {
$destination = $form_state['values']['destination'];
$destination_type = $form_state['values']['destination_type'];
// Check user has enter any path.
$available_urls = array('<current>', '<front>');
if (empty($destination) || $destination_type != 0 || in_array($destination, $available_urls)) {
return;
}
$destination = preg_replace("/\?.+/", "", $destination);
if (url_is_external($destination)) {
return;
}
// Get source path if an alias entered.
$source_path = drupal_lookup_path('source', $destination);
if (!empty($source_path)) {
$destination = $source_path;
}
if (!drupal_valid_path($destination)) {
form_set_error('destination', t('Incorrect path, please enter a valid path.'));
}
}
/**
@@ -296,7 +535,7 @@ function login_destination_edit_form_submit($form, &$form_state) {
}
drupal_set_message(t('Login destination to %destination has been saved.', array('%destination' => $form_state['values']['destination'])));
$form_state['redirect'] = 'admin/config/people/login-destination';
}
@@ -309,14 +548,7 @@ function login_destination_delete_form($form, &$form_state, array $rule) {
'#value' => $rule,
);
return confirm_form(
$form,
t('Are you sure you want to delete the login destination %destination ?', array('%destination' => $rule['destination'])),
'admin/config/people/login-destination',
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')
);
return confirm_form($form, t('Are you sure you want to delete the login destination %destination ?', array('%destination' => $rule['destination'])), 'admin/config/people/login-destination', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}
/**
+4 -6
View File
@@ -1,13 +1,11 @@
name = Login Destination
description = Customize the destination that the user is redirected to after login.
core = 7.x
files[] = login_destination.module
files[] = login_destination.admin.inc
configure = admin/config/people/login-destination
; Information added by drupal.org packaging script on 2012-12-18
version = "7.x-1.1"
; Information added by Drupal.org packaging script on 2016-01-22
version = "7.x-1.4"
core = "7.x"
project = "login_destination"
datestamp = "1355853150"
datestamp = "1453451940"
+62 -6
View File
@@ -58,6 +58,13 @@ function login_destination_schema() {
'default' => 0,
'description' => "The rule's weight.",
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'default' => 1,
'description' => "The rule enabled/disabled status.",
),
),
'primary key' => array('id'),
'indexes' => array(
@@ -69,12 +76,17 @@ function login_destination_schema() {
}
/**
* Implementation of hook_install().
* Implements hook_install().
*/
function login_destination_install() {
// update the alter option of 'user/logout' to TRUE (menu_save invokes necessary hooks)
$result = db_query("SELECT mlid, menu_name FROM {menu_links} WHERE link_path = 'user/logout' OR link_path = 'user/login' OR link_path = 'user' ORDER BY mlid ASC");
foreach($result as $res) {
// Update the alter option of 'user/logout' to TRUE,
// (menu_save invokes necessary hooks).
$result = db_query("
SELECT mlid, menu_name
FROM {menu_links}
WHERE link_path = 'user/logout' OR link_path = 'user/login' OR link_path = 'user'
ORDER BY mlid ASC");
foreach ($result as $res) {
$item = menu_link_load($res->mlid);
$item['options']['alter'] = TRUE;
db_update('menu_links')
@@ -87,13 +99,16 @@ function login_destination_install() {
}
/**
* Implementation of hook_uninstall().
* Implements hook_uninstall().
*/
function login_destination_uninstall() {
variable_del('login_destination_preserve_destination');
variable_del('login_destination_profile_redirect');
}
/**
* Implements hook_update_N().
*/
function login_destination_update_7000() {
$type = variable_get('ld_condition_type', 'always');
$snippet = variable_get('ld_condition_snippet', '');
@@ -117,7 +132,7 @@ function login_destination_update_7000() {
if ($type == 'snippet') {
$form_state['values']['destination_type'] = 1;
// syntax for return value has changed.
// Syntax for return value has changed.
$form_state['values']['destination'] = '<?php /* ' . $snippet . ' */ ?>';
}
else {
@@ -138,3 +153,44 @@ function login_destination_update_7000() {
variable_del('ld_url_type');
variable_del('ld_url_destination');
}
/**
* Implements hook_update_N().
*/
function login_destination_update_7001() {
$spec = array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
);
db_add_field('login_destination', 'enabled', $spec);
}
/**
* Clear hooks cache.
*/
function login_destination_update_7002() {
cache_clear_all('hook_info', 'cache_bootstrap');
}
/**
* Automatically give all roles with permission "Administer Users" the new dedicated permission
* "Administer Login Destination settings".
*/
function login_destination_update_7003() {
drupal_set_message(t('The Login Destination module has just been updated.<br>
A new permission called "Administer Login Destination settings" has now been
added.<br>Previously the access to the Login Destination\'s settings page was
managed by the "Administer Users" permission.<br>That\'s why all roles with
that old permission have been just automatically given the new dedicated
"Administer Login Destination settings" permission.<br>If you want to
duoble-check things, you can go to the
<a href="/admin/people/permissions" title="Permissions page" >Permissions page</a> now.'));
$roles = user_roles(TRUE, 'administer users');
foreach ($roles as $rid => $role_name) {
user_role_grant_permissions($rid, array('administer login destination settings'));
}
}
+134 -77
View File
@@ -5,30 +5,46 @@
* Control where users are directed to, once they login
*/
// Page constants
// Page constants.
define('LOGIN_DESTINATION_REDIRECT_NOTLISTED', 0);
define('LOGIN_DESTINATION_REDIRECT_LISTED', 1);
define('LOGIN_DESTINATION_REDIRECT_PHP', 2);
// Destination constants
// Destination constants.
define('LOGIN_DESTINATION_STATIC', 0);
define('LOGIN_DESTINATION_SNIPPET', 1);
/**
* Implement hook_help().
* Implements hook_help().
*/
function login_destination_help($path, $arg) {
switch ($path) {
case 'admin/help#login_destination':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Login Destination module allows you to customize the destination that the user is redirected to after logging in, registering to the site, using a one-time login link or logging out. The destination can be an internal page or an external URL. You may specify certain conditions like pages or user roles and make the destination depend upon them. You may also use a PHP snippets to provide custom conditions and destinations. Note that PHP Filter module has to be enabled and you have to be granted the "Use PHP for settings" permissions to be able to enter PHP code.') . '</p>';
$output .= '<p>' .
t('The Login Destination module allows you to customize the destination that the user is redirected to after logging in, registering to the site, using a one-time login link or logging out. The destination can be an internal page or an external URL. You may specify certain conditions like pages or user roles and make the destination depend upon them. You may also use a PHP snippets to provide custom conditions and destinations. Note that PHP Filter module has to be enabled and you have to be granted the "Use PHP for settings" permissions to be able to enter PHP code.') .
'</p>';
return $output;
case 'admin/config/people/login-destination':
return '<p>' . t('Login destination rules are evaluated each time a user logs in, registers to the site, uses a one-time login link or logs out. Each rule consists of the destination, path conditions and user roles conditions. First matching rule gets executed.') . '</p>';
return '<p>' .
t('Login destination rules are evaluated each time a user logs in, registers to the site, uses a one-time login link or logs out. Each rule consists of the destination, path conditions and user roles conditions. First matching rule gets executed.') .
'</p>';
}
}
/**
* Implements hook_permission().
*/
function login_destination_permission() {
return array(
'administer login destination settings' => array(
'title' => t('Administer Login Destination settings'),
),
);
}
/**
* Implements hook_menu().
*/
@@ -36,8 +52,9 @@ function login_destination_menu() {
$items['admin/config/people/login-destination'] = array(
'title' => 'Login destinations',
'description' => 'Customize the destination that the user is redirected to after login.',
'page callback' => 'login_destination_overview',
'access arguments' => array('administer users'),
'page callback' => 'drupal_get_form',
'page arguments' => array('login_destination_overview_form'),
'access arguments' => array('administer login destination settings'),
'file' => 'login_destination.admin.inc',
'weight' => 10,
);
@@ -45,7 +62,7 @@ function login_destination_menu() {
'title' => 'Add login destination rule',
'page callback' => 'drupal_get_form',
'page arguments' => array('login_destination_edit_form'),
'access arguments' => array('administer users'),
'access arguments' => array('administer login destination settings'),
'type' => MENU_LOCAL_ACTION,
'weight' => 1,
'file' => 'login_destination.admin.inc',
@@ -54,14 +71,14 @@ function login_destination_menu() {
'title' => 'Edit login destination rule',
'page callback' => 'drupal_get_form',
'page arguments' => array('login_destination_edit_form', 5),
'access arguments' => array('administer users'),
'access arguments' => array('administer login destination settings'),
'file' => 'login_destination.admin.inc',
);
$items['admin/config/people/login-destination/delete/%login_destination'] = array(
'title' => 'Delete login destination rule',
'page callback' => 'drupal_get_form',
'page arguments' => array('login_destination_delete_form', 5),
'access arguments' => array('administer users'),
'access arguments' => array('administer login destination settings'),
'file' => 'login_destination.admin.inc',
);
$items['admin/config/people/login-destination/list'] = array(
@@ -74,7 +91,7 @@ function login_destination_menu() {
'description' => 'Change Login Destination settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array('login_destination_settings'),
'access arguments' => array('administer users'),
'access arguments' => array('administer login destination settings'),
'type' => MENU_LOCAL_TASK,
'file' => 'login_destination.admin.inc',
'weight' => 10,
@@ -102,12 +119,12 @@ function login_destination_load($id) {
if (empty($result['roles'])) {
$result['roles'] = array();
}
return $result;
}
/**
* Implements hook_theme
* Implements hook_theme().
*/
function login_destination_theme() {
return array(
@@ -127,22 +144,26 @@ function login_destination_theme() {
'variables' => array('items' => NULL),
'file' => 'login_destination.admin.inc',
),
'login_destination_overview_form' => array(
'file' => 'login_destination.admin.inc',
'render element' => 'form',
),
);
}
/**
* Implements hook_form_alter
* Implements hook_form_alter().
*/
function login_destination_form_alter(&$form, &$form_state, $form_id) {
// We redirect by using the drupal_goto_alter hook. If we simply
// call drupal_goto() it may break compability with other modules. If we set
// call drupal_goto() it may break compatibility with other modules. If we set
// the $_GET['destination'] variable we will loose the possibility to redirect
// to an external URL.
// Please note the the system_goto_action() calls drupal_goto()
// More on this issue http://drupal.org/node/732542.
// If we add the $form_state['redirect'] here it will be overriden by the
// If we add the $form_state['redirect'] here it will be overridden by the
// user_login_submit(). So we add a submit handler instead and will set the
// redirect later. Our submit handler will be executed after the execution
// of user_login_submit(). This is because form_submit() functions are
@@ -152,14 +173,16 @@ function login_destination_form_alter(&$form, &$form_state, $form_id) {
// original submit function from user module.
switch ($form_id) {
case 'user_register_form': // user register page
case 'user_login': // user login page
// User register page and user login page.
case 'user_register_form':
case 'user_login':
$form['#validate'][] = 'login_destination_validate';
break;
}
switch ($form_id) {
case 'user_profile_form': // one-time login, password reset
// One-time login, password reset.
case 'user_profile_form':
if (isset($_GET['pass-reset-token'])) {
// Redirect only from user_pass_reset
// You have to explicitally turn on the option to always redirect from
@@ -181,20 +204,20 @@ function login_destination_validate($form, &$form_state) {
$_GET['q'] = 'user/register';
}
break;
case 'user_login':
if (drupal_match_path($_GET['q'], 'user/register')) {
$_GET['q'] = 'user';
}
break;
}
// Fix the current page in case of 403 page.
if ($form['#form_id'] == 'user_login') {
if(drupal_get_http_header('Status') == '403 Forbidden') {
if (drupal_get_http_header('Status') == '403 Forbidden') {
$_GET['current'] = $_GET['destination'];
}
}
}
/**
@@ -205,7 +228,7 @@ function login_destination_submit($form, &$form_state) {
}
/**
* Implements hook_menu_link_alter
* Implements hook_menu_link_alter().
*/
function login_destination_menu_link_alter(&$item) {
// Flag a link to be altered by hook_translated_menu_link_alter().
@@ -218,24 +241,29 @@ function login_destination_menu_link_alter(&$item) {
}
/**
* Implements hook_translated_menu_link_alter
* Implements hook_translated_menu_link_alter().
*/
function login_destination_translated_menu_link_alter(&$item, $map) {
global $user;
$paths = array('user/login', 'user');
// Append the current path to URL.
if ($item['link_path'] == 'user/logout' || (in_array($item['link_path'], $paths) && user_is_anonymous())) {
$item['localized_options']['query'] = array('current' => $_GET['q']);
if ($item['link_path'] == 'user/logout' ||
(in_array($item['link_path'], $paths) && user_is_anonymous())
) {
$current = $_GET['q'];
if ($current == '<front>') {
$current = '';
}
$item['localized_options']['query'] = array('current' => $current);
}
}
/**
* Implements hook_page_alter
* Implements hook_page_alter().
*/
function login_destination_page_alter(&$page) {
// Substitute toolbar's pre_render function to change links.
if (isset($page['page_top']['toolbar']['#pre_render'])) {
$page['page_top']['toolbar']['#pre_render'][0] = 'login_destination_toolbar_pre_render';
$page['page_top']['toolbar']['#pre_render'][] = 'login_destination_toolbar_pre_render';
}
}
@@ -243,23 +271,27 @@ function login_destination_page_alter(&$page) {
* Helper function to change toolbar's links.
*/
function login_destination_toolbar_pre_render($toolbar) {
$toolbar = toolbar_pre_render($toolbar);
// Add current param to be able to evaluate previous page.
$toolbar['toolbar_user']['#links']['logout']['query'] = array('current' => $_GET['q']);
return $toolbar;
}
/**
* Implements hook_user_login
* Implements hook_user_login().
*/
function login_destination_user_login(&$edit, $account) {
if (!isset($_POST['form_id']) || $_POST['form_id'] != 'user_pass_reset' || variable_get('login_destination_immediate_redirect', FALSE)) {
$form_exception = 'user_pass_reset';
if (module_exists('change_pwd_page')) {
$form_exception = 'change_pwd_page_user_pass_reset';
}
if (!isset($_POST['form_id']) || $_POST['form_id'] != $form_exception || variable_get('login_destination_immediate_redirect', FALSE)) {
login_destination_perform_redirect('login');
}
}
/**
* Implements hook_user_insert
* Implements hook_user_insert().
*/
function login_destination_user_insert(&$edit, $account, $category) {
global $user;
@@ -272,33 +304,32 @@ function login_destination_user_insert(&$edit, $account, $category) {
}
/**
* Implements hook_user_logout
* Implements hook_user_logout().
*/
function login_destination_user_logout($account) {
login_destination_perform_redirect('logout', _login_destination_get_current('logout'));
}
/**
* Implements hook_drupal_goto_alter
* Implements hook_drupal_goto_alter().
*/
function login_destination_drupal_goto_alter(&$path, &$options, &$http_response_code) {
// Note that this functionality cannot be backported do 6.x as Drupal 6 does
// Note that this functionality cannot be backported to 6.x as Drupal 6 does
// not call drupal_alter for drupal_goto.
// This actually may be used also by templates.
if (isset($GLOBALS['destination'])) {
$destination = $GLOBALS['destination'];
if (!isset($GLOBALS['destination'])) {
return;
}
$destination = $GLOBALS['destination'];
$path = $destination;
// alter drupal_goto
if (is_array($destination)) {
$path = $destination[0];
$options = array();
if (count($destination) > 1) {
$options = $destination[1];
}
}
else {
$path = $destination;
// Alter drupal_goto.
if (is_array($destination)) {
$path = $destination[0];
$options = array();
if (count($destination) > 1) {
$options = $destination[1];
}
}
}
@@ -307,22 +338,28 @@ function login_destination_drupal_goto_alter(&$path, &$options, &$http_response_
* Pass destination to drupal_goto.
*/
function login_destination_prepare_goto($destination) {
// Check if $_GET['destination'] should overwrite us
if (!isset($_GET['destination']) || !variable_get('login_destination_preserve_destination', FALSE)) {
// Check if $_GET['destination'] should overwrite us.
if (!isset($_GET['destination']) ||
!variable_get('login_destination_preserve_destination', FALSE)
) {
$GLOBALS['destination'] = $destination;
}
}
/**
* Evaluate rules and perform redirect.
*
* This function is intended to be used by external modules.
* @param <type> $trigger
* @param <type> $current if null $_GET['q'] is used
*
* @param string $trigger
* Action of login destination rule.
* @param string $current
* Path, if null $_GET['q'] is used.
*/
function login_destination_perform_redirect($trigger = '', $current = NULL) {
$destination = login_destination_get_destination($trigger, $current);
// Check if we redirect
// Check if we redirect.
if ($destination !== FALSE) {
login_destination_prepare_goto($destination);
}
@@ -330,31 +367,39 @@ function login_destination_perform_redirect($trigger = '', $current = NULL) {
/**
* Process all destination rules and return destination path.
*
* This function is intended to be used by external modules.
*/
function login_destination_get_destination($trigger = '', $current = NULL) {
// Get all the login destination rules from the database.
$result = db_select('login_destination', 'l')
//->addTag('translatable')
->fields('l', array('triggers', 'roles', 'pages_type', 'pages', 'destination_type', 'destination'))
->fields('l', array(
'triggers',
'roles',
'pages_type',
'pages',
'destination_type',
'destination',
'enabled',
))
->orderBy('weight')
->execute()
->fetchAll();
if ($current == NULL) {
$current = $_GET['q'];
if ($current === NULL) {
$current = _login_destination_get_current($trigger);
}
// examine path matches
// Examine path matches.
foreach ($result as $data) {
// try to match the subsequent rule
// Try to match the subsequent rule.
if (_login_destination_match_rule($data, $trigger, $current)) {
// Note: Matching rule with empty destination will cancel redirect.
return _login_destination_evaluate_rule($data, $trigger);
}
}
// no rule matched
// No rule matched.
return FALSE;
}
@@ -370,17 +415,21 @@ function _login_destination_eval($code) {
}
/**
* A helper function to provide role options
* A helper function to provide role options.
*/
function _login_destination_role_options() {
// user role selection, without anonymous and authentificated user roles.
// User role selection, without anonymous user roles.
$role_options = array_map('check_plain', user_roles(TRUE));
unset($role_options[DRUPAL_AUTHENTICATED_RID]);
return $role_options;
}
/**
* Get the current path (before trigger was invoked).
*
* @param string $trigger
* Trigger.
*
* @return string
*/
function _login_destination_get_current($trigger = '') {
if (isset($_GET['current'])) {
@@ -391,38 +440,46 @@ function _login_destination_get_current($trigger = '') {
return $_GET['q'];
}
// front by default
// Front by default.
return '';
}
/**
* A helper function to determine whether redirection should happen.
*
* @return bool TRUE - apply redirect, FALSE - not to apply redirect.
* @return bool
* TRUE - apply redirect, FALSE - not to apply redirect.
*/
function _login_destination_match_rule($rule, $trigger = '', $current = NULL) {
global $user;
// Check rule is enabled or not.
if ($rule->enabled == 0) {
return FALSE;
}
$type = $rule->pages_type;
$pages = $rule->pages;
$triggers = unserialize($rule->triggers);
if (empty($triggers))
if (empty($triggers)) {
$triggers = array();
}
$roles = unserialize($rule->roles);
if (empty($roles))
if (empty($roles)) {
$roles = array();
}
// remove non-existent roles
// Remove non-existent roles.
$roles = array_intersect_key(_login_destination_role_options(), $roles);
// examine trigger match
// Examine trigger match.
if (!(empty($triggers) || array_key_exists($trigger, $triggers))) {
return FALSE;
}
// examine role matches
// Examine role matches.
$roles_intersect = array_intersect_key($roles, $user->roles);
if (!empty($roles) && empty($roles_intersect)) {
@@ -456,34 +513,34 @@ function _login_destination_match_rule($rule, $trigger = '', $current = NULL) {
*/
function _login_destination_evaluate_rule($rule, $trigger = '') {
if ($rule->destination_type == LOGIN_DESTINATION_STATIC) {
// take only 1st line
if (preg_match("!^(.*?)$!", $rule->destination, $matches) === 1 ) {
// Take only 1st line.
if (preg_match("!^(.*?)$!", $rule->destination, $matches) === 1) {
$path = $matches[1];
if (empty($path)) {
return FALSE;
}
// Current path
// Current path.
elseif ($path == '<current>') {
return _login_destination_get_current($trigger);
}
// External URL
// External URL.
elseif (strpos($path, '://') !== FALSE) {
return $path;
}
// Internal URL
// Internal URL.
else {
$destination = drupal_parse_url($path);
$options = array();
$options['query'] = $destination['query'];
$options['fragment'] = $destination['fragment'];
// drupal_goto cares about <front>
// Drupal api, drupal_goto cares about <front>.
return array($destination['path'], $options);
}
}
else {
// error - multiple lines
// Error - multiple lines.
return '';
}
}
@@ -0,0 +1,116 @@
7.x-1.5, 2015-05-01
-------------------
- Added CHANGELOG.txt.
- Various one-time-login and validation links don't work with Drupal 6.35 and Drupal 7.35.
- Trimming email input of any stray space characters.
- Merge branch '7.x-1.x' of git.drupal.org:project/logintoboggan into 7.x-1.x.
- Issue #1257572 by md2: reinstates page title on unified login page.
- Improve message consistency.
- Prevent an existing user's email address being used as name by another user.
- Apply patch 1363244-1 to install file.
- Reapply patch after creating new 7.x-1.x dev version.
- Missing parameter in moved_deltas.
7.x-1.4, 2014-07-04
-------------------
- Unified login form not santitizing url.
- Change hook that removes authorized role from users with temporary role so that it happens in all page loads.
7.x-1.3, 2011-11-09
-------------------
- Add logintoboggan_variable module to contrib.
- Update custom js for permissions to keep up with core.
- Setting for optional unsetting of sidebars on access denied pages.
- Removing incorrectly committed file.
- Merge branch 'master' of git.drupal.org:project/logintoboggan.
- Content Access compatibility contrib module README file, bump core version in .info file.
- Deleting the accidently added patch file.
- The LoginToboggan rule module now lists its event in User eventgroup. patch provided by mikewink.
- Document non-authenticated role disables auto-permission from authenticated user.
- Fix errors in t() implementation.
- Content Access compatibility contrib module. implements a hook which specifies to Content Access that the Non-authenticated role, if defined, requires special treatment. i did not test the module at all, the contrib folder is the wild west, so hopefully it works. ;).
- Show unified login on Access Denied. this also abstracts the creation of the unified login form into its own function, and adds a helper function to determine which login form to build based on the LT settings.
- Use format_username() in theme_lt_login_link() function.
- Typo in administration page. Mimimum should be minimum.
- Use single spacing between sentences.
7.x-1.2, 2011-03-04
-------------------
- For #753224 by scor: LoginToboggan Rules now compatible with Drupal7/Rules-7.x.
- Other modules cannot react upon email validation.
- Allow One Time Login To Be Used Only Once.
- Removing translation directories.
- Stripping CVS keywords.
- Disable core 'Require e-mail verification when a visitor creates an account' setting.
7.x-1.1, 2011-01-20
-------------------
- Hook_init too late to remove auth user role.
7.x-1.0, 2011-01-06
-------------------
- Update logintoboggan_rules to 7.x.
- Option for unified login/register page.
- Use user_save instead of update hook in _logintoboggan_process_validation.
- Update registration function with new workflow from core. clean up password description, max length no longer supported. update module help for 7.x.
- Get rid of unnecessary batching function in cron.
- Clean up upgrade file for 7.x.
- Move admin and validation functions to .inc files. various fixes in preparation for 7.x release.
- Move protocol function back to main module file.
- Break out admin pages and validation functions into .inc file.
- Update the permissions js file in line with core updates.
- Update install and readme for 7.x.
- Update .info file for 7.x.
- Add ID tags to css files.
- Bad array syntax in logintoboggan_form_user_admin_permissions_alter.
- Updating js/css handling for 7.x.
- Remove unnecessary check for 'account' form element.
- Ereg deprecated in PHP 5.3, remove from password checking function.
- Enabling of Module Generates Warning from Token Module. move token hooks into separate .inc file.
- Remove 30 char limit for password.
- Email validation sent out even if new account was created by administrator.
7.x-1.0-alpha3, 2010-07-25
--------------------------
- User_register value default has changed, contants for its values. thanks to rfay for the tipoff.
- Remove dead code for predicting if account form was wrapped in a fieldset or not.
- Logintoboggan_main_settings has extraneous form_state arg.
- Remove dead menu caching code.
- Minor update to README.txt of logintoboggan_rules module.
- Fix strict warning.
- Disabling Display of Login Block creates PHP Notices, block settings missing.
- Hide the auth user checkbox on the user edit screen if the user is in the pre-auth role -- reduces UI confusion.
- Non-authenticated role is hidden in user profile form even when 'Set password' is unchecked.
- Redirect on invalid email validation.
- Adding LoginToboggan/Rules integration module.
- Update link to admin'ing roles.
- Use 'Sentence case' for settings page.
- Leverage newly added user_delete_multiple function to purge unvalidated users.
- Remove hard-coded numeric deltas from blocks, per core change.
- Switch to using user_pass_rehash\(\) for validation hashs.
- User interface changes per #546356.
- Cleanup menu paths and arguments.
- Rollback of #48438 due to core's change in #437930.
- Better check for no password.
- Use $_GLOBALS['user'] where appropriate.
- Use #theme element for logged in block.
- Remove unnecessary code causing fatal error.
7.x-1.0-alpha2, 2009-10-25
--------------------------
- Arguments -> variables per change to hook_theme.
7.x-1.0-alpha1, 2009-10-21
--------------------------
- Doxygen cleanups. user_delete -> user_cancel. use batchAPI for deleting unvalidated users.
- Value -> markup. refactor check for a manual removal of the pre-auth role by the admin -- use a hidden form field instead. fix logic for password description. add a missing user message for registration when the pre-auth role is the auth user. fix broken query placeholders. remove unnecessary query that erroneously updated a user's login time when an admin validated their account. fix broken call to drupal_goto. fix up redirect array. use core's user mail functionality for resending validation emails. fix broken mail_alter implementation for admin validation emails.
- Refactor mailing code to use user module's functions, tokens, and hook_mail_alter. make sure anonymous user can't access revalidation link menu callback. remove unneeded security check from registration function.
- Use REQUEST_TIME, as per 7.x upgrade conventions.
- Login successful message now contains username. logged in block now uses theme_username on username. update theme functions to work for 7.x. clean up and refactor the access denied/login form functionality. use a custom user admin permission js file when the pre-auth role is not the auth user -- allows pre-auth role to have lower permissions than auth role.
- Much cleaner implementation of the site 403 variable reset logic.
- Fix login link and collapsible login block for 7.x.
- Update admin paths and help for 7.x.
- More general main settings submit function. refactor site 403 handling to work.
- New admin path for module settings. fix 'Set password' option to work with system_settings_form.
- Ensure arrays before array operations.
@@ -6,9 +6,9 @@ core = "7.x"
dependencies[] = logintoboggan
dependencies[] = content_access
; Information added by Drupal.org packaging script on 2014-07-08
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2015-05-01
version = "7.x-1.5"
core = "7.x"
project = "logintoboggan"
datestamp = "1404818634"
datestamp = "1430501885"
@@ -6,9 +6,9 @@ core = "7.x"
dependencies[] = logintoboggan
dependencies[] = rules
; Information added by Drupal.org packaging script on 2014-07-08
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2015-05-01
version = "7.x-1.5"
core = "7.x"
project = "logintoboggan"
datestamp = "1404818634"
datestamp = "1430501885"
@@ -5,9 +5,9 @@ core = "7.x"
dependencies[] = logintoboggan
dependencies[] = variable
; Information added by Drupal.org packaging script on 2014-07-08
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2015-05-01
version = "7.x-1.5"
core = "7.x"
project = "logintoboggan"
datestamp = "1404818634"
datestamp = "1430501885"
@@ -7,9 +7,9 @@ configure = admin/config/system/logintoboggan
stylesheets[all][] = logintoboggan.css
; Information added by Drupal.org packaging script on 2014-07-08
version = "7.x-1.4"
; Information added by Drupal.org packaging script on 2015-05-01
version = "7.x-1.5"
core = "7.x"
project = "logintoboggan"
datestamp = "1404818634"
datestamp = "1430501885"
@@ -34,7 +34,7 @@ function logintoboggan_update_7000(&$sandbox) {
),
);
update_fix_d7_block_deltas($sandbox, $renamed_deltas);
update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
}
/**
@@ -447,9 +447,8 @@ function logintoboggan_user_register_submit($form, &$form_state) {
$pre_auth = logintoboggan_validating_id() != DRUPAL_AUTHENTICATED_RID;
// If we are allowing user selected passwords then skip the auto-generate function
// The new user's status should default to the site settings, unless reg_passwd_set == 1
// (immediate login, we are going to assign a pre-auth role), and we want to allow
// admin approval accounts access to the site.
// The new user's status will be 1 (visitors can create own accounts) if reg_pass_set == 1
// Immediate login, we are going to assign a pre-auth role, until email validation completed
if ($reg_pass_set) {
$pass = $form_state['values']['pass'];
$status = 1;
@@ -505,7 +504,7 @@ function logintoboggan_user_register_submit($form, &$form_state) {
// 3. Visitors can create their own accounts.
$message = t('Further instructions have been sent to your e-mail address.');
if($reg_pass_set && $pre_auth && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS) {
$message = t('A validation e-mail has been sent to your e-mail address. In order to gain full access to the site, you will need to follow the instructions in that message.');
$message = t('A validation e-mail has been sent to your e-mail address. You will need to follow the instructions in that message in order to gain full access to the site.');
}
if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS) {
@@ -560,9 +559,15 @@ function logintoboggan_user_login_validate($form, &$form_state) {
* @ingroup logintoboggan_form
*/
function logintoboggan_user_register_validate($form, &$form_state) {
//Check to see whether our username matches any email address currently in the system.
if($mail = db_query("SELECT mail FROM {users} WHERE LOWER(:name) = LOWER(mail)", array(
':name' => $form_state['values']['name'],
))->fetchField()) {
form_set_error('name', t('This e-mail has already been taken by another user.'));
}
//Check to see whether our e-mail address matches the confirm address if enabled.
if (variable_get('logintoboggan_confirm_email_at_registration', 0) && isset($form_state['values']['conf_mail'])) {
if ($form_state['values']['mail'] != $form_state['values']['conf_mail']) {
if (trim($form_state['values']['mail']) != trim($form_state['values']['conf_mail'])) {
form_set_error('conf_mail', t('Your e-mail address and confirmed e-mail address must match.'));
}
}
@@ -756,8 +761,6 @@ function logintoboggan_unified_login_page($active_form = 'login') {
return menu_execute_active_handler(NULL, FALSE);
}
else {
// Title just clutters the interface...
drupal_set_title('');
$output = logintoboggan_get_authentication_form($active_form);
return $output;
}
@@ -1051,11 +1054,11 @@ function logintoboggan_process_login($account, &$edit, $redirect = array()){
function logintoboggan_eml_validate_url($account, $url_options){
$timestamp = REQUEST_TIME;
return url("user/validate/$account->uid/$timestamp/". logintoboggan_eml_rehash($account->pass, $timestamp, $account->mail), $url_options);
return url("user/validate/$account->uid/$timestamp/". logintoboggan_eml_rehash($account->pass, $timestamp, $account->mail, $account->uid), $url_options);
}
function logintoboggan_eml_rehash($password, $timestamp, $mail) {
return user_pass_rehash($password, $timestamp, $mail);
function logintoboggan_eml_rehash($password, $timestamp, $mail, $uid) {
return user_pass_rehash($password, $timestamp, $mail, $uid);
}
/**
@@ -10,6 +10,14 @@ Drupal.behaviors.unifiedLogin = {
$('.toboggan-unified #login-link').removeClass('lt-active');
$('.toboggan-unified #register-form').show();
$('.toboggan-unified #login-form').hide();
$.ajax({
url: "/user/register",
success: function(data) {
var title = data.match("<title>(.*?)</title>")[1];
$('html head').find('title').text(title);
$('h1.title').text(title.substring(0,title.indexOf('|')));
},
});
return false;
});
$('.toboggan-unified #login-link').click(function() {
@@ -17,6 +25,14 @@ Drupal.behaviors.unifiedLogin = {
$('.toboggan-unified #register-link').removeClass('lt-active');
$('.toboggan-unified #login-form').show();
$('.toboggan-unified #register-form').hide();
$.ajax({
url: "/user/login",
success: function(data) {
var title = data.match("<title>(.*?)</title>")[1];
$('html head').find('title').text(title);
$('h1.title').text(title.substring(0,title.indexOf('|')));
},
});
return false;
});
@@ -32,5 +48,4 @@ Drupal.behaviors.unifiedLogin = {
}
};
})(jQuery);
})(jQuery);
@@ -22,7 +22,7 @@ function logintoboggan_validate_email($account, $timestamp, $hashed_pass, $actio
// - the user is still in the pre-auth role or didn't set
// their own password.
// - the hashed password is correct.
if (((variable_get('user_email_verification', TRUE) && empty($account->login)) || ($pre_auth && array_key_exists($validating_id, $account->roles))) && $hashed_pass == logintoboggan_eml_rehash($account->pass, $timestamp, $account->mail)) {
if (((variable_get('user_email_verification', TRUE) && empty($account->login)) || ($pre_auth && array_key_exists($validating_id, $account->roles))) && $hashed_pass == logintoboggan_eml_rehash($account->pass, $timestamp, $account->mail, $account->uid)) {
watchdog('user', 'E-mail validation URL used for %name with timestamp @timestamp.', array('%name' => $account->name, '@timestamp' => $timestamp));
_logintoboggan_process_validation($account);