summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEoleDev <EoleDev@outlook.fr>2016-03-23 14:43:27 +0100
committerEoleDev <EoleDev@outlook.fr>2016-03-23 14:43:27 +0100
commitd3fc2ab36ced70c8eb20e7f85f900425b7781667 (patch)
treee325f9dce61a176e5a1d5585461ddd19c668b5fd
parenta26989103d70fb0dd3ff6834de107cae246778c3 (diff)
parentf9643dd9ffeec5eda4f563dd695135ac3a681d60 (diff)
Merge branch 'Eole' into develop
Conflicts: client/js/controllers/home/home.js
-rw-r--r--client/js/app.js2
-rwxr-xr-x[-rw-r--r--]client/js/controllers/home/home.js23
-rw-r--r--server/config.inc.php1
-rwxr-xr-xserver/core/App.php4
-rwxr-xr-xserver/core/LibOverride/genTokenOptions.php10
-rwxr-xr-xserver/index.php5
6 files changed, 38 insertions, 7 deletions
diff --git a/client/js/app.js b/client/js/app.js
index 1602e65..a26e0ec 100644
--- a/client/js/app.js
+++ b/client/js/app.js
@@ -24,7 +24,7 @@ mainApp.config(['$routeProvider', function($routeProvider){
templateUrl: 'partials/image/image.html',
controller: 'imageCtrl'
}).otherwise({
- redirectTo: '/home'
+ redirectTo: '/'
});
}]);
diff --git a/client/js/controllers/home/home.js b/client/js/controllers/home/home.js
index 2b355b1..3332a10 100644..100755
--- a/client/js/controllers/home/home.js
+++ b/client/js/controllers/home/home.js
@@ -9,16 +9,31 @@ mainApp.controller('homeCtrl', [ '$scope', 'Compute', '$rootScope', 'Loading','I
var callMeAfterPullData=function(data){
$scope.machines=Compute.getData().machines;
Loading.stop();
- };
-
-
+ }
+
+ ;
+ if(Compute.getData().machines == null && Identity.isAlreadyLogin()){
+ Loading.start();
+ Compute.pullData(callMeAfterPullData);
+ }
+ else{
+ if(Identity.isAlreadyLogin()){
+ callMeAfterPullData();
+ }
+ }
+
+
+ Image.getImages(function(){});
+
+
+
$scope.raiseShowMachineDetailsEvent=function(id){
var callback=function(){
Loading.stop();
var data=Compute.getData();
$rootScope.$broadcast("showMachineDetailsEvent", data.machines[id], data.axioms);
-
+
}
Loading.start();
Compute.pullMachines(callback);
diff --git a/server/config.inc.php b/server/config.inc.php
index 9767c72..636ee5e 100644
--- a/server/config.inc.php
+++ b/server/config.inc.php
@@ -5,6 +5,7 @@
$config["modules_enabled"] = "";
$config["urlAuth"] = "http://148.60.11.31:5000/v3";
+ $config["tokenTime"] = 60 //miunte = 60 //miuntess
?>
diff --git a/server/core/App.php b/server/core/App.php
index d35ccc0..e3c9c22 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -37,6 +37,10 @@ class App{
}
+ public function checkToken(){
+ $this->tokenClass->checkToken();
+ }
+
public function getLibClass($service){
switch($service){
diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php
index bdae8a6..028226a 100755
--- a/server/core/LibOverride/genTokenOptions.php
+++ b/server/core/LibOverride/genTokenOptions.php
@@ -49,6 +49,12 @@ class genTokenOptions
$stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter']));
}
}
+
+ public function checkToken(){
+
+ return $this->backup['time'] > time();
+
+ }
public function genIdentityToken(){
$options = $this->optionsGlobal['Common'];
@@ -271,6 +277,7 @@ class genTokenOptions
$path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"];
//error_log(print_r($path, true), 0);
file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved']));
+ $this->backup['time'] = $token['time'];
$this->backup["roles"] = $token["roles"];
$this->backup["project"] = $token['saved']["project"]["name"];
$this->backup["user"] = $token["user"];
@@ -284,7 +291,7 @@ class genTokenOptions
public function loadBackup($back){
$backup = unserialize($back);
-
+ $this->backup['time'] = $backup['time'];
$this->backup["roles"] = $backup["roles"];
$this->backup["project"] = $backup["project"];
$this->backup["user"] = $backup["user"];
@@ -343,6 +350,7 @@ class genTokenOptions
$tokenSerialized["user"]["name"] = serialize($token->user->name);
$tokenSerialized["token"]["issued"] = serialize($token->issued);
$tokenSerialized["token"]["id"] = serialize($token->id);
+ $tokenSerialized['time'] = time()+$config['tokenTime']*60;
return $tokenSerialized;
}
diff --git a/server/index.php b/server/index.php
index 31feb08..4e9c82b 100755
--- a/server/index.php
+++ b/server/index.php
@@ -22,7 +22,7 @@
$App->deauthenticate();
$App->show();
- }else{
+ }else if($App->checkToken()){
switch($task)
{
case "identity":
@@ -54,6 +54,9 @@
break;
}
+ }else{
+ $App->setOuptut("Error", "Token Invalide");
+ $App->show();
}