Fix abstract passwords in host/domain manage planel logins
This commit is contained in:
@@ -14,14 +14,14 @@ class Model_Host_Server extends ORMOSB {
|
||||
// Host Server doesnt use the update column
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
public function manage_button($u,$p,$d) {
|
||||
public function manage_button(Model_Service_Plugin_Host $spho,$t) {
|
||||
$c = sprintf('Service_Host_%s',$this->provision_plugin);
|
||||
if (! class_exists($c))
|
||||
return '';
|
||||
|
||||
$po = new $c($this->id);
|
||||
|
||||
return $po->manage_button($u,$p,$d);
|
||||
return $po->manage_button($spho,$t);
|
||||
}
|
||||
|
||||
public function prov_plugin_data() {
|
||||
|
@@ -58,31 +58,26 @@ class Model_Service_Plugin_Host extends Model_Service_Plugin {
|
||||
->set('so',$this);
|
||||
}
|
||||
|
||||
public function username_value() {
|
||||
return $this->host_username;
|
||||
}
|
||||
|
||||
public function password_value() {
|
||||
return $this->host_password;
|
||||
}
|
||||
|
||||
/**
|
||||
* This provides us with a manage button to jump to the hosting server
|
||||
* to manage the domain.
|
||||
*/
|
||||
public function manage_button() {
|
||||
$k = Random::char();
|
||||
Session::instance()->set('manage_button',$k);
|
||||
|
||||
Script::add(array('type'=>'stdin','data'=>'
|
||||
$(document).ready(function() {
|
||||
var x=0;
|
||||
$("button[name=submit]").click(function() {
|
||||
if (x++) { alert("Please refresh the page"); return false; }
|
||||
$.getJSON("'.URL::site('user/service/ajaxmanage/'.$this->service_id).'", { k: "'.$k.'" }, function(data) {
|
||||
$.each(data, function(key, val) { $("#"+key).val(val); });
|
||||
}).error(function() { alert("There was a problem with the request"); return false; }).success(function() { $("#manage").submit(); });
|
||||
});
|
||||
});'
|
||||
));
|
||||
public function manage_button($t='') {
|
||||
parent::manage_button($t);
|
||||
|
||||
// @todo Convert this to a Static_List display
|
||||
if ($this->service->queue == 'PROVISION')
|
||||
return _('To Be Provisioned');
|
||||
|
||||
return ($this->host_username AND $this->host_password) ? $this->host_server->manage_button($this->host_username,substr(md5($this->host_password),0,8),$this->name()) : '';
|
||||
return ($this->username_value() AND $this->password_value()) ? $this->host_server->manage_button($this,$t) : _('Please contact us');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -36,8 +36,10 @@ abstract class Service_Host {
|
||||
|
||||
/**
|
||||
* Our HTML button that will enable us to manage this domain.
|
||||
*
|
||||
* @param so Our Service Object
|
||||
*/
|
||||
abstract public function manage_button($u,$p,$d);
|
||||
abstract public function manage_button(Model_Service_Plugin_Host $spho,$t);
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
|
@@ -16,17 +16,18 @@ class Service_Host_Plesk extends Service_Host {
|
||||
private $login_pass_field = 'passwd';
|
||||
|
||||
// Our required abstract classes
|
||||
public function manage_button($u,$p,$d) {
|
||||
public function manage_button(Model_Service_Plugin_Host $spho,$t) {
|
||||
$debug = FALSE;
|
||||
$output = '';
|
||||
|
||||
$output .= Form::open(
|
||||
sprintf('%s/%s',$this->so->manage_url,'login_up.php3'),
|
||||
array('target'=>'w24','method'=>'post','id'=>'manage')
|
||||
$debug ? 'debug/site' : sprintf('%s/%s',$this->so->manage_url,'login_up.php3'),
|
||||
array('target'=>'w24','method'=>'post','id'=>sprintf('id_%s_%s',$spho->service_id,$t))
|
||||
);
|
||||
$output .= Form::input($this->login_user_field,$u,array('type'=>'hidden','id'=>'u'));
|
||||
$output .= Form::input($this->login_pass_field,$p,array('type'=>'hidden','id'=>'p'));
|
||||
$output .= Form::input($this->login_user_field,$spho->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spho->service_id,$t)));
|
||||
$output .= Form::input($this->login_pass_field,substr(md5($spho->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spho->service_id,$t)));
|
||||
$output .= Form::close();
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button'));
|
||||
$output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$spho->service_id,$t)));
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user