Added password change to plesk

This commit is contained in:
Deon George
2012-07-12 21:18:22 +10:00
parent 8100fa2540
commit 25c73e2819
6 changed files with 102 additions and 3 deletions

View File

@@ -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');
}
}
?>