Fix abstract passwords in host/domain manage planel logins
This commit is contained in:
@@ -22,10 +22,11 @@ class Controller_User_Service extends Controller_TemplateDefault_User {
|
||||
|
||||
$so = ORM::factory('service',$this->request->param('id'));
|
||||
$k = Session::instance()->get_once('manage_button');
|
||||
$amo = $so->plugin(isset($_REQUEST['t']) ? $_REQUEST['t'] : '');
|
||||
|
||||
$o = array(
|
||||
'u'=>$so->plugin()->host_username ? $so->plugin()->host_username : strtolower($so->plugin()->name()),
|
||||
'p'=>(! $k OR ! $this->request->is_ajax() OR ! $so->loaded() OR ! isset($_REQUEST['k']) OR $k != $_REQUEST['k']) ? Random::char() : $so->plugin()->host_password,
|
||||
'u'=>$amo->username_value() ? $amo->username_value() : strtolower($amo->name()),
|
||||
'p'=>(! $k OR ! $this->request->is_ajax() OR ! $so->loaded() OR ! isset($_REQUEST['k']) OR $k != $_REQUEST['k']) ? Random::char() : $amo->password_value(),
|
||||
);
|
||||
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
|
@@ -49,14 +49,16 @@ class Model_Service extends ORMOSB {
|
||||
/**
|
||||
* Return the object of the product plugin
|
||||
*/
|
||||
public function plugin() {
|
||||
public function plugin($type='') {
|
||||
if (! $this->product->prod_plugin_file)
|
||||
return NULL;
|
||||
|
||||
if (! is_numeric($this->product->prod_plugin_data))
|
||||
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
|
||||
|
||||
return ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
|
||||
$o = ORM::factory(sprintf('service_plugin_%s',$this->product->prod_plugin_file),array('service_id'=>$this->id));
|
||||
|
||||
return $type ? $o->$type : $o;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -36,6 +36,37 @@ abstract class Model_Service_Plugin extends ORMOSB {
|
||||
*/
|
||||
abstract public function service_view();
|
||||
|
||||
/**
|
||||
* The table attributes that provide username/password values
|
||||
*/
|
||||
abstract public function username_value();
|
||||
abstract public function password_value();
|
||||
|
||||
public function manage_button() {
|
||||
static $k = '';
|
||||
|
||||
// If $k is already set, we've rendered this JS
|
||||
if ($k)
|
||||
return;
|
||||
|
||||
$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() {
|
||||
var t=$(this).val().split(":");
|
||||
if (x++) { alert("Please refresh the page"); return false; }
|
||||
$.getJSON("'.URL::site('user/service/ajaxmanage/'.$this->service_id).'", { k: "'.$k.'",t: t[1] }, function(data) {
|
||||
$.each(data, function(key, val) { $("#"+key+"_"+t[0]+"_"+t[1]).val(val); });
|
||||
}).error(function() { alert("There was a problem with the request"); return false; }).success(
|
||||
function() { $("form[id=id_"+t[0]+"_"+t[1]+"]").submit(); });
|
||||
});
|
||||
});'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get specific service details for use in other modules
|
||||
* For Example: Invoice
|
||||
|
Reference in New Issue
Block a user