Work on Email and other major consistency work

This commit is contained in:
Deon George
2013-11-22 15:36:50 +11:00
parent 89deb9c97b
commit c18d5a3881
55 changed files with 550 additions and 575 deletions

View File

@@ -15,13 +15,13 @@ class Controller_User_SSL extends Controller_SSL {
);
public function action_download() {
$id = $_POST['sid'];
$so = ORM::factory('Service',$id);
$so = ORM::factory('Service',$this->request->post('sid'));
if (! $so->loaded())
HTTP::redirect('welcome/index');
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account))
throw HTTP_Exception::factory(403,'Service either doesnt exist, or you are not authorised to see it');
$passwd = $this->request->post('passwd');
$passwd = $_POST['passwd'];
if (strlen($passwd) < Kohana::$config->load('ssl')->minpass_length) {
SystemMessage::add(array(
'title'=>_('Validation failed'),
@@ -32,11 +32,6 @@ class Controller_User_SSL extends Controller_SSL {
HTTP::redirect(URL::link('user','service/view/'.$so->id));
}
if (! $so->loaded() OR ! Auth::instance()->authorised($so->account)) {
$this->template->content = 'Unauthorised or doesnt exist?';
return FALSE;
}
// Log the download
$smo = $so->service_memo;
$smo->service_id = $so->id;
@@ -49,10 +44,11 @@ class Controller_User_SSL extends Controller_SSL {
openssl_pkcs12_export_to_file($so->plugin()->cert,$file,$so->plugin()->pk,$passwd,array('extracerts'=>$so->plugin()->cacerts()));
$x = file_get_contents($file);
unlink($file);
$this->auto_render = FALSE;
$this->response->headers('Content-Type','application/pks12');
$this->response->headers('Content-Disposition','attachment; filename="'.basename($file).'"');
$this->response->body($x);
$this->auto_render = FALSE;
}
}
?>