示例#1
0
 /**
  * @param string $old_password
  * @param string $new_password
  * @return boolean true on success
  */
 public function changePassword($old_password, $new_password)
 {
     $uh = new MailboxHandler();
     if (!$uh->init($_SESSION['sessid']['username'])) {
         return false;
     }
     return $uh->change_pw($new_password, $old_password);
 }
示例#2
0
 /**
  * Interactive
  *
  * @access private
  */
 function __handle($address, $password = NULL, $random = false)
 {
     if ($random == true) {
         $password = generate_password();
     }
     if ($password != NULL) {
         $handler = new MailboxHandler();
         if (!$handler->init($address)) {
             $this->error("Change Password", join("\n", $handler->errormsg));
         }
         if (!$handler->change_pw($password, NULL, false)) {
             $this->error("Change Password", join("\n", $handler->errormsg));
         }
     }
     $this->out("");
     $this->out("Password updated.");
     $this->hr();
     $this->out(sprintf('The Mail address is  %20s', $address));
     $this->out(sprintf('The new password is %20s', $password));
     $this->hr();
     return;
 }
示例#3
0
        flash_error($validpass[0]);
        # TODO: honor all error messages, not only the first one
        $error += 1;
    }
    $mh = new MailboxHandler();
    if (!$mh->login($username, $fPassword_current)) {
        $error += 1;
        $pPassword_password_current_text = $PALANG['pPassword_password_current_text_error'];
    }
    if (empty($fPassword) or $fPassword != $fPassword2) {
        $error += 1;
        $pPassword_password_text = $PALANG['pPassword_password_text_error'];
    }
    if ($error == 0) {
        $mh->init($username);
        # TODO: error handling
        if ($mh->change_pw($fPassword, $fPassword_current)) {
            flash_info(Config::Lang_f('pPassword_result_success', $username));
            header("Location: main.php");
            exit(0);
        } else {
            flash_error(Config::Lang_f('pPassword_result_error', $username));
        }
    }
}
$smarty->assign('SESSID_USERNAME', $username);
$smarty->assign('pPassword_password_current_text', $pPassword_password_current_text, false);
$smarty->assign('pPassword_password_text', $pPassword_password_text, false);
$smarty->assign('smarty_template', 'password');
$smarty->display('index.tpl');
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */