Added password change to plesk
This commit is contained in:
@@ -25,6 +25,7 @@ class Controller_Task_Host extends Controller_Task {
|
||||
case 'gettraffic':
|
||||
case 'migrate':
|
||||
case 'provision':
|
||||
case 'resetpw':
|
||||
$this->so = ORM::factory('service',$this->request->param('id'));
|
||||
|
||||
if (! $this->so->loaded())
|
||||
@@ -252,5 +253,17 @@ class Controller_Task_Host extends Controller_Task {
|
||||
$result = $this->hpo->provision($this->so);
|
||||
print_r((string)$result);
|
||||
}
|
||||
|
||||
public function action_resetpw() {
|
||||
$pw = PWGen::get(TRUE);
|
||||
|
||||
$spho = $this->so->plugin();
|
||||
$spho->host_password = $pw;
|
||||
|
||||
if (! ($result = $this->hpo->setpasswd($this->so,$pw)) OR ! $result->loaded() OR ! $spho->save())
|
||||
throw new Kohana_Exception('Unable to set password.');
|
||||
|
||||
echo _('Password Reset Success');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -47,7 +47,7 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
|
||||
$client = $this->packet->add_node('customer');
|
||||
$get = $client->add_node('get');
|
||||
$filter = $get->add_node('filter');
|
||||
$filter->add_node('login',$so->plugin()->host_account);
|
||||
$filter->add_node('login',$so->plugin()->host_username);
|
||||
$dataset = $get->add_node('dataset');
|
||||
foreach ($items as $k)
|
||||
$dataset->add_node($k);
|
||||
@@ -172,7 +172,7 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
|
||||
$gen_info->add_node('cname',$so->account->company);
|
||||
$gen_info->add_node('pname',sprintf('%s %s',$so->account->first_name,$so->account->last_name));
|
||||
|
||||
$gen_info->add_node('login',$so->plugin()->host_account);
|
||||
$gen_info->add_node('login',$so->plugin()->host_username);
|
||||
$gen_info->add_node('passwd',$so->plugin()->host_password);
|
||||
|
||||
$gen_info->add_node('status',0);
|
||||
@@ -229,5 +229,19 @@ class Host_Plugin_Plesk_10 extends Host_Plugin_Plesk {
|
||||
|
||||
return $this->packet->add_node($type);
|
||||
}
|
||||
|
||||
public function setpasswd(Model_Service $so,$pw) {
|
||||
$this->init();
|
||||
|
||||
$client = $this->packet->add_node('customer');
|
||||
$set = $client->add_node('set');
|
||||
$filter = $set->add_node('filter');
|
||||
$filter->add_node('login',$so->plugin()->host_username);
|
||||
$values = $set->add_node('values');
|
||||
$gen_info = $values->add_node('gen_info');
|
||||
$gen_info->add_node('passwd',$pw);
|
||||
|
||||
return $this->server_command($this->xml);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -88,7 +88,7 @@ class Host_Plugin_Plesk_9 extends Host_Plugin_Plesk {
|
||||
$client = $this->packet->add_node('client');
|
||||
$get = $client->add_node('get');
|
||||
$filter = $get->add_node('filter');
|
||||
$filter->add_node('login',$so->plugin()->host_account);
|
||||
$filter->add_node('login',$so->plugin()->host_username);
|
||||
$dataset = $get->add_node('dataset');
|
||||
foreach ($items as $k)
|
||||
$dataset->add_node($k);
|
||||
@@ -303,5 +303,19 @@ class Host_Plugin_Plesk_9 extends Host_Plugin_Plesk {
|
||||
return $this->server_command($this->xml);
|
||||
*/
|
||||
}
|
||||
|
||||
public function setpasswd(Model_Service $so,$pw) {
|
||||
$this->init();
|
||||
|
||||
$client = $this->packet->add_node('client');
|
||||
$set = $client->add_node('set');
|
||||
$filter = $set->add_node('filter');
|
||||
$filter->add_node('login',$so->plugin()->host_username);
|
||||
$values = $set->add_node('values');
|
||||
$gen_info = $values->add_node('gen_info');
|
||||
$gen_info->add_node('passwd',$pw);
|
||||
|
||||
return $this->server_command($this->xml);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user