示例#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;
 }
 protected function storemore()
 {
     if ($this->new) {
         if (!$this->mailbox_post_script()) {
             # return false; # TODO: should this be fatal?
         }
         if ($this->values['welcome_mail'] == true) {
             if (!$this->send_welcome_mail()) {
                 # return false; # TODO: should this be fatal?
             }
         }
         if (!$this->create_mailbox_subfolders()) {
             $this->infomsg[] = Config::lang_f('pCreate_mailbox_result_succes_nosubfolders', $this->id);
         }
     } else {
         # edit mode
         # alias active status is updated in before_store()
         # postedit hook
         # TODO: implement a poststore() function? - would make handling of old and new values much easier...
         $old_mh = new MailboxHandler();
         if (!$old_mh->init($this->id)) {
             $this->errormsg[] = $old_mh->errormsg[0];
         } elseif (!$old_mh->view()) {
             $this->errormsg[] = $old_mh->errormsg[0];
         } else {
             $oldvalues = $old_mh->result();
             $this->values['maildir'] = $oldvalues['maildir'];
             if (isset($this->values['quota'])) {
                 $quota = $this->values['quota'];
             } else {
                 $quota = $oldvalues['quota'];
             }
             if (!$this->mailbox_post_script()) {
                 # TODO: should this be fatal?
             }
         }
     }
     return true;
     # even if a hook failed, mark the overall operation as OK
 }
示例#4
0
 protected function validate_new_id()
 {
     # vacation can only be enabled if a mailbox with this name exists
     $handler = new MailboxHandler();
     return $handler->init($address);
 }
示例#5
0
    if (count($validpass) > 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');