diff --git a/dbee.module b/dbee.module index 4d11a3c..dbccb66 100644 --- a/dbee.module +++ b/dbee.module @@ -523,46 +523,6 @@ function dbee_user_account_form_validate($form, &$form_state) { } /** - * Implements hook_form_FORM_ID_alter(). - * - * Replace the email validation callback into the "ask new password" form. - */ -function dbee_form_user_pass_alter(&$form, &$form_state, $form_id) { - $to_replace = 'user_pass_validate'; - $replaced_by = 'dbee_user_pass_validate'; - $key_to_replace = array_search($to_replace, $form['#validate']); - if ($key_to_replace !== FALSE) { - $form['#validate'][$key_to_replace] = $replaced_by; - } -} - -/** - * Form validation handler for user_pass(). - * - * This function replace the user_pass_validate() core function. - * - * @see user_pass_validate() - */ -function dbee_user_pass_validate($form, &$form_state) { - $name = trim($form_state['values']['name']); - // Try to load by email. - // HERE: we edit the core function. - $users = user_load_multiple(array(), array('dbee_mail' => dbee_encrypt($name, TRUE), 'status' => '1')); - $account = reset($users); - if (!$account) { - // No success, try to load by name. - $users = user_load_multiple(array(), array('name' => $name, 'status' => '1')); - $account = reset($users); - } - if (isset($account->uid)) { - form_set_value(array('#parents' => array('account')), $account, $form_state); - } - else { - form_set_error('name', t('Sorry, %name is not recognized as a user name or an e-mail address.', array('%name' => $name))); - } -} - -/** * Implements hook_aes_config_change(). */ function dbee_aes_config_change($decrypt_params, $encrypt_params) { @@ -935,6 +895,18 @@ function dbee_where_clause(&$query, $users_alias, $dbee_alias) { $operator = drupal_strtoupper($where_properties['operator']); $where_match = in_array($operator, array('LIKE', '=', 'IN')); + // Special behavior regarding issues #2324701 and #2616264 + // (https://www.drupal.org/node/2616264#comment-10576582). + // Due to MySQL collation, queries are executed as insensitive case. + if (isset($query->alterTags['user_load_multiple'])) { + if ($operator == '=') { + $operator = 'LIKE'; + } + elseif ($operator == '<>') { + $operator = 'NOT LIKE'; + } + } + // The where clause needs to decrypt all users on complex searchs // with wildcards ('_' and '%'),