Merge "Improve login and logout + replaced tabs by spaces"
This commit is contained in:
commit
404011bf7e
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
angular.module('bansho', [
|
angular.module('bansho', [
|
||||||
'ngRoute',
|
'ngRoute',
|
||||||
|
'ngCookies',
|
||||||
'angular.filter',
|
'angular.filter',
|
||||||
'bansho.config',
|
'bansho.config',
|
||||||
'bansho.authentication',
|
'bansho.authentication',
|
||||||
|
@ -55,3 +55,8 @@
|
|||||||
@import '../../components/topbar/topbar';
|
@import '../../components/topbar/topbar';
|
||||||
@import '../../components/sidebar/sidebar';
|
@import '../../components/sidebar/sidebar';
|
||||||
@import '../../components/tactical/tactical';
|
@import '../../components/tactical/tactical';
|
||||||
|
|
||||||
|
//----------------------------------*\
|
||||||
|
// TEMPORARY MODULES
|
||||||
|
//----------------------------------*/
|
||||||
|
@import 'temporary';
|
||||||
|
32
app/assets/sass/temporary.scss
Normal file
32
app/assets/sass/temporary.scss
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
.centered {
|
||||||
|
position: fixed;
|
||||||
|
margin-top: 15px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bansho-title {
|
||||||
|
color: #ddd;
|
||||||
|
font-size: 300%;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
float: right;
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
width: 85px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
@ -1,19 +1,31 @@
|
|||||||
|
<div class="centered">
|
||||||
|
<h1 class="bansho-title">Bansho</h1>
|
||||||
|
<p>Web client for Surveil</p>
|
||||||
|
|
||||||
|
<h2>Login</h2>
|
||||||
|
<br>
|
||||||
<form name="loginForm"
|
<form name="loginForm"
|
||||||
ng-controller="LoginController"
|
ng-controller="LoginController"
|
||||||
ng-submit="login(credentials)" novalidate>
|
ng-submit="login(credentials)" novalidate>
|
||||||
|
|
||||||
<label for="username">Username:</label>
|
<div class="form-group">
|
||||||
<input type="text" id="username"
|
<label for="username" class="label">Username:</label>
|
||||||
|
<input type="text" id="username" class="form-control field"
|
||||||
ng-model="credentials.auth.passwordCredentials.username">
|
ng-model="credentials.auth.passwordCredentials.username">
|
||||||
|
</div>
|
||||||
|
|
||||||
<label for="password">Password:</label>
|
<div class="form-group">
|
||||||
<input type="password" id="password"
|
<label for="password" class="label">Password:</label>
|
||||||
|
<input type="password" class="form-control field" id="password"
|
||||||
ng-model="credentials.auth.passwordCredentials.password">
|
ng-model="credentials.auth.passwordCredentials.password">
|
||||||
|
</div>
|
||||||
|
|
||||||
<label for="tenantName">Tenant Name:</label>
|
<div class="form-group">
|
||||||
<input type="text" id="tenant-name"
|
<label for="tenantName" class="label">Tenant Name:</label>
|
||||||
|
<input type="text" id="tenant-name"class="form-control field"
|
||||||
ng-model="credentials.auth.tenantName">
|
ng-model="credentials.auth.tenantName">
|
||||||
|
</div>
|
||||||
|
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
@ -28,6 +28,10 @@ angular.module('bansho.authentication', [])
|
|||||||
login($scope.credentials);
|
login($scope.credentials);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (authService.isAuthenticated()) {
|
||||||
|
login($scope.credentials);
|
||||||
|
}
|
||||||
|
|
||||||
configManager.loadDevelopmentConfig().then(function () {
|
configManager.loadDevelopmentConfig().then(function () {
|
||||||
var devConfig = configManager.getDevelopmentConfig();
|
var devConfig = configManager.getDevelopmentConfig();
|
||||||
if (devConfig.env === 'development') {
|
if (devConfig.env === 'development') {
|
||||||
@ -73,21 +77,33 @@ angular.module('bansho.authentication', [])
|
|||||||
};
|
};
|
||||||
|
|
||||||
authService.isAuthenticated = function () {
|
authService.isAuthenticated = function () {
|
||||||
return !!session.sessionId;
|
return !!session.isUserConnected();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
authService.logout = function () {
|
||||||
|
$rootScope.isAuthenticated = false;
|
||||||
|
session.destroy();
|
||||||
|
$location.path('/login');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return authService;
|
return authService;
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.service('session', function () {
|
.service('session', ['$cookies', function ($cookies) {
|
||||||
|
this.isUserConnected = function () {
|
||||||
|
return $cookies.connected === 'true';
|
||||||
|
};
|
||||||
|
|
||||||
this.create = function (sessionId, expirationTime) {
|
this.create = function (sessionId, expirationTime) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
this.expirationTime = expirationTime;
|
this.expirationTime = expirationTime;
|
||||||
|
$cookies.connected = 'true';
|
||||||
};
|
};
|
||||||
|
|
||||||
this.destroy = function () {
|
this.destroy = function () {
|
||||||
this.sessionId = null;
|
this.sessionId = null;
|
||||||
this.expirationTime = null;
|
this.expirationTime = null;
|
||||||
|
$cookies.connected = 'false';
|
||||||
};
|
};
|
||||||
});
|
}]);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"env": "development",
|
"env": "production",
|
||||||
"username":"",
|
"username":"",
|
||||||
"password":""
|
"password":""
|
||||||
}
|
}
|
||||||
|
@ -131,16 +131,7 @@
|
|||||||
<li class="topbar__settings__subitem"><a href="#">Missing Plugins</a></li>
|
<li class="topbar__settings__subitem"><a href="#">Missing Plugins</a></li>
|
||||||
<li class="topbar__settings__subitem"><a href="#">Object History</a></li>
|
<li class="topbar__settings__subitem"><a href="#">Object History</a></li>
|
||||||
<li class="topbar__settings__subitem"><a href="#">Configure</a></li>
|
<li class="topbar__settings__subitem"><a href="#">Configure</a></li>
|
||||||
</ul>
|
<li class="topbar__settings__subitem" ng-click="logout()"><a>Logout</a></li>
|
||||||
</li>
|
|
||||||
<li class="topbar__settings__item">
|
|
||||||
<span class="topbar__settings__category">Nagios</span>
|
|
||||||
|
|
||||||
<ul class="topbar__settings__sublist">
|
|
||||||
<li class="topbar__settings__subitem"><a href="#">Settings</a></li>
|
|
||||||
<li class="topbar__settings__subitem"><a href="#">Edit nagios.cfg</a></li>
|
|
||||||
<li class="topbar__settings__subitem"><a href="#">Nagios Service</a></li>
|
|
||||||
<li class="topbar__settings__subitem"><a href="#">Pnp intergration</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
angular.module('bansho.topbar', ['bansho.live'])
|
angular.module('bansho.topbar', ['bansho.live'])
|
||||||
|
|
||||||
.controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager',
|
.controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager', 'authService',
|
||||||
function ($rootScope, $scope, $interval, backendClient, promisesManager) {
|
function ($rootScope, $scope, $interval, backendClient, promisesManager, authService) {
|
||||||
var getData,
|
var getData,
|
||||||
hostProblems,
|
hostProblems,
|
||||||
serviceProblems;
|
serviceProblems;
|
||||||
@ -23,6 +23,10 @@ angular.module('bansho.topbar', ['bansho.live'])
|
|||||||
// TODO: Change hardcoded interval when the topbar dashboard will be implemented
|
// TODO: Change hardcoded interval when the topbar dashboard will be implemented
|
||||||
promisesManager.addAjaxPromise($interval(getData, 10000));
|
promisesManager.addAjaxPromise($interval(getData, 10000));
|
||||||
getData();
|
getData();
|
||||||
|
|
||||||
|
$scope.logout = function () {
|
||||||
|
authService.logout();
|
||||||
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.directive('banshoTopbar', function () {
|
.directive('banshoTopbar', function () {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<!-- build:js js/app.min.js -->
|
<!-- build:js js/app.min.js -->
|
||||||
<script src="bower_components/angular/angular.js"></script>
|
<script src="bower_components/angular/angular.js"></script>
|
||||||
<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
|
<script src="bower_components/angular-filter/dist/angular-filter.min.js"></script>
|
||||||
|
<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
|
||||||
<script src="bower_components/angular-route/angular-route.js"></script>
|
<script src="bower_components/angular-route/angular-route.js"></script>
|
||||||
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
||||||
<script src="bower_components/moment/moment.js"></script>
|
<script src="bower_components/moment/moment.js"></script>
|
||||||
|
15
bower.json
15
bower.json
@ -5,15 +5,16 @@
|
|||||||
"license": "AGPLv3",
|
"license": "AGPLv3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular": "1.2.x",
|
"angular": "~1.3.15",
|
||||||
"angular-route": "1.2.x",
|
"angular-route": "~1.3.15",
|
||||||
"angular-loader": "1.2.x",
|
"angular-loader": "~1.3.15",
|
||||||
"angular-mocks": "~1.2.x",
|
"angular-mocks": "~1.3.15",
|
||||||
"html5-boilerplate": "~4.3.0",
|
"html5-boilerplate": "~5.2.0",
|
||||||
"bootstrap-sass-official": "3.3.1",
|
"bootstrap-sass-official": "3.3.1",
|
||||||
"fontawesome": "4.2.0",
|
"fontawesome": "~4.3.0",
|
||||||
"justgage-toorshia": "master",
|
"justgage-toorshia": "master",
|
||||||
"moment": "~2.9.0",
|
"moment": "~2.9.0",
|
||||||
"angular-filter": "~0.5.4"
|
"angular-filter": "~0.5.4",
|
||||||
|
"angular-cookies": "~1.3.15"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user