<?php

class ChangePasswordPage extends CMSUpdatePageBase{
	
	private $failed = false;

	function doPost(){
		if($this->updatePassword()){
    		$this->addMessage("CHANGE_PASSWORD_SUCCESS");
			$this->jump("Administrator");
		}else{
			$this->failed = true;
		}
	}

    function ChangePasswordPage() {
    	WebPage::WebPage();
    	$this->addForm("change_password_form");

    	$this->createAdd("error","HTMLModel",array(
    		"visible" => $this->failed
    	));

    }
    
    /**
     * 現在の管理者のパスワードを変更します
     * Administrator
     * @return boolean
     */
    function updatePassword(){
    	$action = SOY2ActionFactory::createInstance("Administrator.ChangePasswordAction");
    	$result = $action->run();
    	
    	return $result->success();
    	
    }
}
?>