X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fchange_password%2Ffunctions.php;h=34be450b183b0327237faba9edfbd79e1fb97b58;hb=b4d528823ec03ff0482dd244a4186e06a0bdd001;hp=e9cf52f48887f3e213dcde0270b034a83e105201;hpb=5c34b0bbf0fc464baa22d6ae069d4b7bd305d2cf;p=squirrelmail.git diff --git a/plugins/change_password/functions.php b/plugins/change_password/functions.php index e9cf52f4..34be450b 100644 --- a/plugins/change_password/functions.php +++ b/plugins/change_password/functions.php @@ -1,10 +1,21 @@ $cpw_pass_max_length ) ) { $msg[] = sprintf(_("Your new password should be %s to %s characters long."), @@ -41,9 +56,9 @@ function cpw_check_input() } // do we need to do checks that are backend-specific and should - // be handled by a hook? I know of none now, but if there's a need - // for it we can add a hook for that here. - // those checks can also be done in the backend dochange() function. + // be handled by a hook? I know of none now, bnd those checks can + // also be done in the backend dochange() function. If there turns + // out to be a need for it we can add a hook for that here. return $msg; } @@ -61,8 +76,8 @@ define('CPW_INVALID_PW', _("Your new password contains invalid characters.")); function cpw_do_change() { global $cpw_backend; - sqgetGlobalVar('cpw_current', $curpw, SQ_POST); - sqgetGlobalVar('cpw_new', $newpw, SQ_POST); + sqgetGlobalVar('cpw_curpass', $curpw, SQ_POST); + sqgetGlobalVar('cpw_newpass', $newpw, SQ_POST); sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); sqgetGlobalVar('key', $key, SQ_COOKIE); @@ -70,12 +85,12 @@ function cpw_do_change() require_once(SM_PATH . 'plugins/change_password/backend/'.$cpw_backend.'.php'); - $msgs = do_hook_function('change_password_dochange', - array ( - 'username' => $username, - 'curpw' => $curpw, - 'newpw' => $newpw - ) ); + $msgs = do_hook('change_password_dochange', + $temp=array ( + 'username' => &$username, + 'curpw' => &$curpw, + 'newpw' => &$newpw + ) ); /* something bad happened, return */ if(count($msgs) > 0) { @@ -84,12 +99,13 @@ function cpw_do_change() /* update our password stored in the session */ $onetimepad = OneTimePadCreate(strlen($newpw)); - $_SESSION['onetimepad'] = $onetimepad; + sqsession_register($onetimepad,'onetimepad'); $key = OneTimePadEncrypt($newpw, $onetimepad); - setcookie('key', $key, 0, $base_uri); + sqsetcookie('key', $key, 0, $base_uri); /* make sure we write the session data before we redirect */ session_write_close(); - header('Location: '.SM_PATH. 'src/options.php?optmode=submit&plugin_change_password=1'); + header('Location: '.SM_PATH. 'src/options.php?optmode=submit&optpage=change_password&plugin_change_password=1&smtoken=' . sm_generate_security_token()); exit; } +