Merge branch 'develop' into Eole
This commit is contained in:
commit
2b38742bce
20 changed files with 120 additions and 28 deletions
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
<!-- Include JQuery -->
|
<!-- Include JQuery -->
|
||||||
<script src="./vendors/jquery/jquery-2.2.0.min.js"></script>
|
<script src="./vendors/jquery/jquery-2.2.0.min.js"></script>
|
||||||
|
|
||||||
<!-- Include Bootstrap -->
|
<!-- Include Bootstrap -->
|
||||||
<script src="./vendors/bootstrap/js/bootstrap.min.js"></script>
|
<script src="./vendors/bootstrap/js/bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@
|
||||||
<script src="./vendors/angularjs/angular.min.js"></script>
|
<script src="./vendors/angularjs/angular.min.js"></script>
|
||||||
<script src="./vendors/angularjs/angular-route.min.js"></script>
|
<script src="./vendors/angularjs/angular-route.min.js"></script>
|
||||||
<script src="./vendors/angularjs/angular-sanitize.min.js"></script>
|
<script src="./vendors/angularjs/angular-sanitize.min.js"></script>
|
||||||
|
<script src="./vendors/angularjs/angular-cookies.min.js"></script>
|
||||||
<script src="./js/app.js"></script>
|
<script src="./js/app.js"></script>
|
||||||
|
|
||||||
<!-- Include services -->
|
<!-- Include services -->
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* The main app module instance
|
* The main app module instance
|
||||||
* @type angular.module.angular-1_3_6_L1749.moduleInstance
|
* @type angular.module.angular-1_3_6_L1749.moduleInstance
|
||||||
*/
|
*/
|
||||||
var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize']);
|
var mainApp=angular.module("mainApp",['ngRoute', 'ngSanitize', 'ngCookies']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure routeProvider
|
* Configure routeProvider
|
||||||
|
@ -29,6 +29,5 @@ mainApp.config(['$routeProvider', function($routeProvider){
|
||||||
*/
|
*/
|
||||||
mainApp.config(['$httpProvider', function($httpProvider){
|
mainApp.config(['$httpProvider', function($httpProvider){
|
||||||
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
1
client/js/controllers/.#status.js
Symbolic link
1
client/js/controllers/.#status.js
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
loic@Manzerbredes.home.30343:1455008378
|
|
@ -9,14 +9,20 @@
|
||||||
*/
|
*/
|
||||||
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
|
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
|
||||||
{
|
{
|
||||||
// Define default states
|
// Check for login and define default states
|
||||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
if(!Identity.isAlreadyLogin()){
|
||||||
|
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||||
|
}
|
||||||
|
$scope.$on('logoutEvent', function(){
|
||||||
|
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||||
|
});
|
||||||
|
|
||||||
$('#loadingLoginButton').hide();
|
$('#loadingLoginButton').hide();
|
||||||
$('#failedToLoginAlert').hide();
|
$('#failedToLoginAlert').hide();
|
||||||
|
|
||||||
|
|
||||||
$('#loginButton').click(function(){
|
$scope.loginAction=function(){
|
||||||
|
|
||||||
// Begin login state for template
|
// Begin login state for template
|
||||||
$('#loginButton').hide();
|
$('#loginButton').hide();
|
||||||
$('#loadingLoginButton').show();
|
$('#loadingLoginButton').show();
|
||||||
|
@ -49,6 +55,6 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
|
||||||
|
|
||||||
// Try to login
|
// Try to login
|
||||||
Identity.login(username, password, projectname, responseCallback);
|
Identity.login(username, password, projectname, responseCallback);
|
||||||
});
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -6,9 +6,14 @@
|
||||||
* @param {$scope} $scope The $scope service from angular
|
* @param {$scope} $scope The $scope service from angular
|
||||||
* @param {Identity} The Identity service
|
* @param {Identity} The Identity service
|
||||||
*/
|
*/
|
||||||
mainApp.controller('statusCtrl', ['$scope','Identity', function ($scope, Identity)
|
mainApp.controller('statusCtrl', ['$scope','Identity', '$rootScope', function ($scope, Identity, $rootScope)
|
||||||
{
|
{
|
||||||
$scope.profile=Identity.profile;
|
$scope.profile=Identity.profile;
|
||||||
|
|
||||||
|
$scope.logout=function(){
|
||||||
|
Identity.logout();
|
||||||
|
$rootScope.$broadcast('logoutEvent');
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
mainApp.factory('Identity',[ '$http', function($http){
|
mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
||||||
|
|
||||||
/* Create profile structure to store informations
|
/* Create profile structure to store informations
|
||||||
* about current session
|
* about current session
|
||||||
|
@ -9,7 +9,72 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
profile.projectname=null;
|
profile.projectname=null;
|
||||||
profile.token=null;
|
profile.token=null;
|
||||||
|
|
||||||
|
/* var tokenFragment=9;
|
||||||
|
|
||||||
|
var saveTokenInCookies=function(){
|
||||||
|
var i=0;
|
||||||
|
var currentStart=0;
|
||||||
|
var currentEnd=parseInt(profile.token.length/tokenFragment);
|
||||||
|
var facto=currentEnd;
|
||||||
|
|
||||||
|
alert("current ren" + currentEnd);
|
||||||
|
for(i=0;i<tokenFragment-1;i++){
|
||||||
|
|
||||||
|
$cookies.put("token-"+i, profile.token.substring(currentStart, currentEnd));
|
||||||
|
|
||||||
|
|
||||||
|
currentStart=currentEnd+1;
|
||||||
|
currentEnd=currentEnd+facto;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$cookies.put("token-"+(i+1), profile.token.substring(currentEnd, profile.token.length));
|
||||||
|
};
|
||||||
|
|
||||||
|
var loadTokenInCookies=function(){
|
||||||
|
var i=0;
|
||||||
|
|
||||||
|
profile.token=$cookies.get("token-0");
|
||||||
|
for(i=1;i<tokenFragment;i++){
|
||||||
|
|
||||||
|
profile.token=profile.token+$cookies.get("token-"+i)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var saveCookieForSession=function(){
|
||||||
|
$cookies.putObject('profile', 5);
|
||||||
|
//saveTokenInCookies();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var isAlreadyLogin=function(){
|
||||||
|
var profileInCookie=$cookies.getObject('profile');
|
||||||
|
console.log(profileInCookie);
|
||||||
|
|
||||||
|
if(typeof profileInCookie !== 'undefined'){
|
||||||
|
angular.extend(profile, profileInCookie);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var logout=function(){
|
||||||
|
$cookies.remove('profile');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} response The response to parse
|
* @param {string} response The response to parse
|
||||||
|
@ -17,6 +82,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
* @returns {requestParserResult} Formated data
|
* @returns {requestParserResult} Formated data
|
||||||
*/
|
*/
|
||||||
var parseLoginAnswer=function(response, failedToSendRequest){
|
var parseLoginAnswer=function(response, failedToSendRequest){
|
||||||
|
|
||||||
|
|
||||||
var requestParserResult={};
|
var requestParserResult={};
|
||||||
requestParserResult.status=1;
|
requestParserResult.status=1;
|
||||||
|
@ -24,7 +90,8 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
|
|
||||||
if (typeof response.data.token !== 'undefined') {
|
if (typeof response.data.token !== 'undefined') {
|
||||||
requestParserResult.status=0;
|
requestParserResult.status=0;
|
||||||
profile.token=response.data.token;
|
profile.token=response.data.token;
|
||||||
|
saveCookieForSession();
|
||||||
}
|
}
|
||||||
else if(failedToSendRequest){
|
else if(failedToSendRequest){
|
||||||
requestParserResult.failReason="Failed to send request";
|
requestParserResult.failReason="Failed to send request";
|
||||||
|
@ -48,7 +115,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
* @param {function} function to call when data is avalaible
|
* @param {function} function to call when data is avalaible
|
||||||
*/
|
*/
|
||||||
var login=function(username, password,projectname, callback){
|
var login=function(username, password,projectname, callback){
|
||||||
|
|
||||||
// Set profile information (early)
|
// Set profile information (early)
|
||||||
profile.username=username;
|
profile.username=username;
|
||||||
profile.projectname=projectname;
|
profile.projectname=projectname;
|
||||||
|
@ -67,7 +134,9 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
// Return services objects
|
// Return services objects
|
||||||
return {
|
return {
|
||||||
login: login,
|
login: login,
|
||||||
profile: profile
|
profile: profile,
|
||||||
|
isAlreadyLogin: isAlreadyLogin,
|
||||||
|
logout:logout
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
|
|
||||||
mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
|
mainApp.factory('Image',[ '$http', 'Identity', function($http, Identity){
|
||||||
|
|
||||||
var httpResponse;
|
|
||||||
|
|
||||||
var uploadImage=function(image){
|
|
||||||
|
var parseUploadImageAnswer=function(response, failedToSendRequest){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var parseUploadImageRequest=function(){
|
|
||||||
|
var getImages=function(callback){
|
||||||
|
|
||||||
|
var result=$http.post('../server/index.php',
|
||||||
|
$.param({"token" : Identity.profile.token, "task" : "Image"}));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var getResponse=function(){
|
|
||||||
return parseUploadImageRequest(httpResponse);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Return services objects
|
// Return services objects
|
||||||
return {
|
return {
|
||||||
uploadImage: uploadImage,
|
uploadImage: uploadImage
|
||||||
getResponse: getResponse
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<!--<a href="#" data-dismiss="modal" class="btn btn-default">Close</a>-->
|
<!--<a href="#" data-dismiss="modal" class="btn btn-default">Close</a>-->
|
||||||
<button class="btn btn-lg btn-warning btn-block" id="loadingLoginButton"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</button>
|
<button class="btn btn-lg btn-warning btn-block" id="loadingLoginButton"><span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> Loading...</button>
|
||||||
<div class="alert alert-danger text-center" role="alert" id="failedToLoginAlert"><b>Failed to login</b></b><br />{{ failReason }}</div>
|
<div class="alert alert-danger text-center" role="alert" id="failedToLoginAlert"><b>Failed to login</b></b><br />{{ failReason }}</div>
|
||||||
<a href="#" class="btn btn-lg btn-primary btn-block" id="loginButton" ng-click="processForm()">Login</a>
|
<a href="#" class="btn btn-lg btn-primary btn-block" id="loginButton" ng-click="loginAction()">Login</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
<li><a href="#">Informations</a></li>
|
<li><a href="#">Informations</a></li>
|
||||||
<li><a href="#">Settings</a></li>
|
<li><a href="#">Settings</a></li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li><a href="#myModal" data-toggle="modal">Logout</a>
|
<li><a href="#" ng-click="logout()">Logout</a></li>
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
9
client/vendors/angularjs/angular-cookies.min.js
vendored
Normal file
9
client/vendors/angularjs/angular-cookies.min.js
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/*
|
||||||
|
AngularJS v1.5.0
|
||||||
|
(c) 2010-2016 Google, Inc. http://angularjs.org
|
||||||
|
License: MIT
|
||||||
|
*/
|
||||||
|
(function(p,c,n){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096<f&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
|
||||||
|
f+" > 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,n,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore",
|
||||||
|
["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular);
|
||||||
|
//# sourceMappingURL=angular-cookies.min.js.map
|
0
server/Test/genTokenOptionsTest.php
Executable file → Normal file
0
server/Test/genTokenOptionsTest.php
Executable file → Normal file
0
server/composer.phar
Executable file → Normal file
0
server/composer.phar
Executable file → Normal file
0
server/core/App.php
Executable file → Normal file
0
server/core/App.php
Executable file → Normal file
0
server/core/CoreInterface.php
Executable file → Normal file
0
server/core/CoreInterface.php
Executable file → Normal file
0
server/core/Identity.php
Executable file → Normal file
0
server/core/Identity.php
Executable file → Normal file
0
server/core/LibOverride/genTokenOptions.php
Executable file → Normal file
0
server/core/LibOverride/genTokenOptions.php
Executable file → Normal file
0
server/index.php
Executable file → Normal file
0
server/index.php
Executable file → Normal file
0
server/init.php
Executable file → Normal file
0
server/init.php
Executable file → Normal file
0
server/vendor/justinrainbow/json-schema/bin/validate-json
vendored
Executable file → Normal file
0
server/vendor/justinrainbow/json-schema/bin/validate-json
vendored
Executable file → Normal file
2
server/vendor/php-opencloud/openstack
vendored
2
server/vendor/php-opencloud/openstack
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 1419eb2e01164bb6b8b837df37724423907352d7
|
Subproject commit 15aca73f423166c7ef8337ba08615c103c66e931
|
Loading…
Add table
Reference in a new issue