Changeset 4595 in subversion


Ignore:
Timestamp:
Mar 7, 2011 2:52:35 AM (2 years ago)
Author:
alec
Message:
  • When old and new passwords are the same, do nothing, return success (#1487823)
Location:
trunk/plugins/password
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/password/README

    r4546 r4595  
    257257 Driver file (<driver_name>.php) must define 'password_save' function with 
    258258 two arguments. First - current password, second - new password. Function 
    259  may return PASSWORD_SUCCESS on success or any of PASSWORD_CONNECT_ERROR, 
     259 should return PASSWORD_SUCCESS on success or any of PASSWORD_CONNECT_ERROR, 
    260260 PASSWORD_CRYPT_ERROR, PASSWORD_ERROR when driver was unable to change password. 
    261  See existing drivers in drivers/ directory for examples. 
    262  
     261 Extended result (as a hash-array with 'message' and 'code' items) can be returned 
     262 too. See existing drivers in drivers/ directory for examples. 
  • trunk/plugins/password/drivers/sql.php

    r4308 r4595  
    138138            if ($result = $db->fetch_array($res)) 
    139139                        return PASSWORD_SUCCESS; 
    140             } else {  
     140            } else { 
     141            // This is the good case: 1 row updated 
    141142            if ($db->affected_rows($res) == 1) 
    142                         return PASSWORD_SUCCESS; // This is the good case: 1 row updated 
     143                    return PASSWORD_SUCCESS; 
     144            // @TODO: Some queries don't affect any rows 
     145            // Should we assume a success if there was no error? 
    143146            } 
    144147    } 
  • trunk/plugins/password/package.xml

    r4546 r4595  
    1616                <active>yes</active> 
    1717        </lead> 
    18         <date>2011-02-15</date> 
    19         <time>12:00</time> 
     18        <date></date> 
     19        <time></time> 
    2020        <version> 
    21                 <release>2.2</release> 
     21                <release></release> 
    2222                <api>1.6</api> 
    2323        </version> 
     
    2828        <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> 
    2929        <notes> 
    30 - hMail driver: add username_domain detection (#1487100) 
    31 - hMail driver: HTML tags in logged messages should be stripped off (#1487099) 
    32 - Chpasswd driver: add newline at end of input to chpasswd binary (#1487141) 
    33 - Fix usage of configured temp_dir instead of /tmp (#1487447) 
    34 - ldap_simple driver: fix parse error 
    35 - ldap/ldap_simple drivers: support %dc variable in config 
    36 - ldap/ldap_simple drivers: support Samba password change 
    37 - Fix extended error messages handling (#1487676) 
    38 - Fix double request when clicking on Password tab in Firefox 
    39 - Fix deprecated split() usage in xmail and directadmin drivers (#1487769) 
    40 - Added option (password_log) for logging password changes 
    41 - Virtualmin driver: Add option for setting username format (#1487781) 
     30- When old and new passwords are the same, do nothing, return success (#1487823) 
    4231    </notes> 
    4332        <contents> 
     
    246235            </notes> 
    247236        </release> 
     237        <release> 
     238                <date>2011-02-15</date> 
     239                <time>12:00</time> 
     240                <version> 
     241                        <release>2.2</release> 
     242                        <api>1.6</api> 
     243                </version> 
     244                <stability> 
     245                        <release>stable</release> 
     246                        <api>stable</api> 
     247                </stability> 
     248                <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license> 
     249                <notes> 
     250- hMail driver: add username_domain detection (#1487100) 
     251- hMail driver: HTML tags in logged messages should be stripped off (#1487099) 
     252- Chpasswd driver: add newline at end of input to chpasswd binary (#1487141) 
     253- Fix usage of configured temp_dir instead of /tmp (#1487447) 
     254- ldap_simple driver: fix parse error 
     255- ldap/ldap_simple drivers: support %dc variable in config 
     256- ldap/ldap_simple drivers: support Samba password change 
     257- Fix extended error messages handling (#1487676) 
     258- Fix double request when clicking on Password tab in Firefox 
     259- Fix deprecated split() usage in xmail and directadmin drivers (#1487769) 
     260- Added option (password_log) for logging password changes 
     261- Virtualmin driver: Add option for setting username format (#1487781) 
     262            </notes> 
     263        </release> 
    248264    </changelog> 
    249265</package> 
  • trunk/plugins/password/password.php

    r4544 r4595  
    9292            $rc_charset = strtoupper($rcmail->output->get_charset()); 
    9393 
    94             $curpwd = get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset); 
     94            $sespwd = $rcmail->decrypt($_SESSION['password']); 
     95            $curpwd = $confirm ? get_input_value('_curpasswd', RCUBE_INPUT_POST, true, $charset) : $sespwd; 
    9596            $newpwd = get_input_value('_newpasswd', RCUBE_INPUT_POST, true); 
    9697            $conpwd = get_input_value('_confpasswd', RCUBE_INPUT_POST, true); 
     
    116117                $rcmail->output->command('display_message', $this->gettext('passwordinconsistency'), 'error'); 
    117118            } 
    118             else if ($confirm && $rcmail->decrypt($_SESSION['password']) != $curpwd) { 
     119            else if ($confirm && $sespwd != $curpwd) { 
    119120                $rcmail->output->command('display_message', $this->gettext('passwordincorrect'), 'error'); 
    120121            } 
     
    125126            else if ($check_strength && (!preg_match("/[0-9]/", $newpwd) || !preg_match("/[^A-Za-z0-9]/", $newpwd))) { 
    126127                $rcmail->output->command('display_message', $this->gettext('passwordweak'), 'error'); 
     128            } 
     129            // password is the same as the old one, do nothing, return success 
     130            else if ($sespwd == $newpwd) { 
     131                $rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation'); 
    127132            } 
    128133            // try to save the password 
Note: See TracChangeset for help on using the changeset viewer.