Changeset 64608bf in github


Ignore:
Timestamp:
Feb 25, 2010 5:56:01 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
e62346c
Parents:
951c07b1
Message:
  • Password: Make passwords encoding consistent with core, add 'password_charset' global option (#1486473)
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r951c07b1 r64608bf  
    22=========================== 
    33 
     4- Password: Make passwords encoding consistent with core, add 'password_charset' global option (#1486473) 
    45- Fix adding contacts SQL error on mysql (#1486459) 
    56- Squirrelmail_usercopy: support reply-to field (#1486506) 
  • config/main.inc.php.dist

    rc3b6763 r64608bf  
    123123// localhost if that isn't defined.  
    124124$rcmail_config['smtp_helo_host'] = ''; 
     125 
     126// Password charset. 
     127// Use it if your authentication backend doesn't support UTF-8. 
     128// Defaults to ISO-8859-1 for backward compatibility 
     129$rcmail_config['password_charset'] = 'ISO-8859-1'; 
    125130 
    126131// Log sent messages 
  • index.php

    r7481dd9 r64608bf  
    8383    'user' => trim(get_input_value('_user', RCUBE_INPUT_POST)), 
    8484    'cookiecheck' => true, 
    85   )) + array('pass' => get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1')); 
     85  )); 
     86   
     87  if (!isset($auth['pass'])) 
     88    $auth['pass'] = get_input_value('_pass', RCUBE_INPUT_POST, true, 
     89        $RCMAIL->config->get('password_charset', 'ISO-8859-1')); 
    8690 
    8791  // check if client supports cookies 
     
    8993    $OUTPUT->show_message("cookiesdisabled", 'warning'); 
    9094  } 
    91   else if ($_SESSION['temp'] && !$auth['abort'] && !empty($auth['host']) && 
    92             !empty($auth['user']) && isset($auth['pass']) &&  
    93             $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) { 
     95  else if ($_SESSION['temp'] && !$auth['abort'] && 
     96        !empty($auth['host']) && !empty($auth['user']) && 
     97        $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) { 
    9498    // create new session ID 
    9599    rcube_sess_unset('temp'); 
  • plugins/password/localization/en_US.inc

    re7b283b r64608bf  
    1212$messages['passwordincorrect'] = 'Current password incorrect.'; 
    1313$messages['passwordinconsistency'] = 'Passwords do not match, please try again.'; 
    14 $messages['crypterror'] = 'Could not save new password. Encrypt function missing.'; 
     14$messages['crypterror'] = 'Could not save new password. Encryption function missing.'; 
    1515$messages['connecterror'] = 'Could not save new password. Connection error.'; 
    1616$messages['internalerror'] = 'Could not save new password.'; 
    17 $messages['passwordshort'] = 'Your password must be at least $length characters long.'; 
    18 $messages['passwordweak'] = 'Your new password must include at least one number and one punctuation character.'; 
     17$messages['passwordshort'] = 'Password must be at least $length characters long.'; 
     18$messages['passwordweak'] = 'Password must include at least one number and one punctuation character.'; 
     19$messages['passwordforbidden'] = 'Password contains forbidden characters.'; 
    1920 
    2021?> 
  • plugins/password/localization/pl_PL.inc

    re7b283b r64608bf  
    2222$messages['passwordweak'] = 'Hasło musi zawierać co najmniej jednĠ
    2323 cyfrę i znak interpunkcyjny.'; 
     24$messages['passwordforbidden'] = 'Hasło zawiera niedozwolone znaki.'; 
    2425 
    2526?> 
  • plugins/password/password.php

    ra65bf3a r64608bf  
    8787    else { 
    8888 
    89       $curpwd = get_input_value('_curpasswd', RCUBE_INPUT_POST); 
    90       $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST); 
    91       $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST); 
    92  
    93       if ($conpwd != $newpwd) { 
     89      $charset = strtoupper($rcmail->config->get('password_charset', 'ISO-8859-1')); 
     90      $rc_charset = strtoupper($rcmail->output->get_charset()); 
     91 
     92      $curpwd = get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset); 
     93      $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST, true); 
     94      $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST, true); 
     95 
     96      // check allowed characters according to the configured 'password_charset' option 
     97      // by converting the password entered by the user to this charset and back to UTF-8 
     98      $orig_pwd = $newpwd; 
     99      $chk_pwd = rcube_charset_convert($orig_pwd, $rc_charset, $charset); 
     100      $chk_pwd = rcube_charset_convert($chk_pwd, $charset, $rc_charset); 
     101 
     102      // WARNING: Default password_charset is ISO-8859-1, so conversion will 
     103      // change national characters. This may disable possibility of using 
     104      // the same password in other MUA's. 
     105      // We're doing this for consistence with Roundcube core 
     106      $newpwd = rcube_charset_convert($newpwd, $rc_charset, $charset); 
     107      $conpwd = rcube_charset_convert($conpwd, $rc_charset, $charset); 
     108 
     109      if ($chk_pwd != $orig_pwd) { 
     110        $rcmail->output->command('display_message', $this->gettext('passwordforbidden'), 'error'); 
     111      } 
     112      // other passwords validity checks 
     113      else if ($conpwd != $newpwd) { 
    94114        $rcmail->output->command('display_message', $this->gettext('passwordinconsistency'), 'error'); 
    95115      } 
     
    104124        $rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error'); 
    105125      } 
     126      // try to save the password 
    106127      else if (!($res = $this->_save($curpwd,$newpwd))) { 
    107128        $rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation'); 
Note: See TracChangeset for help on using the changeset viewer.