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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user