Ignore:
Timestamp:
Feb 9, 2014, 10:09:04 PM (10 years ago)
Author:
LucMorizur
Message:

Fix bug:3044

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/main.inc.php

    r27129 r27296  
    5151// Define prefilter to add tooltips on register page
    5252add_event_handler('init', 'LCAS_InitPage');
    53  
     53
     54// For page password.php, modifies $POST['username_or_email'] with registered
     55// username, if this username is found in the DB with current rules of LCAS.
     56add_event_handler('loc_begin_password', 'LCAS_InitPage');
     57
    5458function LCAS_InitPage()
    5559{
    56   global $template, $conf, $lang;
    57 
    58   $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
     60  global $conf;
     61
     62  $conf_LCAS = unserialize($conf['LoginCaseAccentsSensitivity']);
    5963 
    6064  // Set $conf['insensitive_case_logon'] to false, as LCAS takes completely
    6165  // in charge everything concerning the case and the accents in the login
    6266  if ($conf_LCAS[0] != '0') $conf['insensitive_case_logon'] = false;
    63  
    64   /* User identification */
    65   if (script_basename() == 'identification')
    66   {
    67     if (isset($_POST['username']) and isset($conf_LCAS[0]))
    68     {
    69       $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[0]);
    70       $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username;
    71     }
    72   }
    73  
     67
     68  $s = script_basename();
    7469  // Add tooltips on register page
    75   if (script_basename() == 'register') {
     70  if ($s == 'register') {
    7671    $template->assign(array(
    7772      'LCAS_username_tooltip' => $lang['LCAS_tooltip_username_register'][intval($conf_LCAS[0])],
     
    7974    ));
    8075    $template->set_prefilter('register', 'LCAS_add_tooltips_prefilter_register');
     76  }
     77  else if ($s == 'identification') $p = 'username';
     78  else if ($s == 'password') $p = 'username_or_email';
     79  else return false;
     80  if (isset($_POST[$p]) and isset($conf_LCAS[0])) {
     81    $new_username = LCAS_SearchCaseUsername($_POST[$p],$conf_LCAS[0]);
     82    $_POST[$p] = $new_username == '' ? $_POST[$p] : $new_username;
    8183  }
    8284}
Note: See TracChangeset for help on using the changeset viewer.