Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 068117c

Browse files
committed
gh-118 Add form-based non-oauth login page
1 parent 38e4be7 commit 068117c

File tree

8 files changed

+114
-28
lines changed

8 files changed

+114
-28
lines changed

ui/app/index.html

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,28 @@
4040
</p>
4141
<p ng-if="user.authenticationEnabled && !user.isAuthenticated" class="navbar-text navbar-right">Not logged in</p>
4242
<ul class="nav navbar-nav navbar-right">
43-
<li ng-class="{ active: $state.includes('home.apps') }">
43+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
44+
ng-class="{ active: $state.includes('home.apps') }">
4445
<a ui-sref="home.apps.tabs.appsList">Apps</a>
4546
</li>
46-
<li ng-class="{ active: $state.includes('home.runtime') }">
47+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
48+
ng-class="{ active: $state.includes('home.runtime') }">
4749
<a ui-sref="home.runtime.tabs.runtimeAppsList">Runtime</a>
4850
</li>
49-
<li ng-show="features.streamsEnabled" ng-class="{ active: $state.includes('home.streams') }">
51+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
52+
ng-show="features.streamsEnabled" ng-class="{ active: $state.includes('home.streams') }">
5053
<a ui-sref="home.streams.tabs.definitions">Streams</a>
5154
</li>
52-
<li ng-show="features.tasksEnabled" ng-class="{ active: $state.includes('home.tasks') }">
55+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
56+
ng-show="features.tasksEnabled" ng-class="{ active: $state.includes('home.tasks') }">
5357
<a ui-sref="home.tasks.tabs.definitions">Tasks</a>
5458
</li>
55-
<li ng-show="features.tasksEnabled" ng-class="{ active: $state.includes('home.jobs') }">
59+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
60+
ng-show="features.tasksEnabled" ng-class="{ active: $state.includes('home.jobs') }">
5661
<a ui-sref="home.jobs.tabs.executions">Jobs</a>
5762
</li>
58-
<li ng-show="features.analyticsEnabled" ng-class="{ active: $state.includes('home.analytics') }">
63+
<li ng-hide="user.authenticationEnabled && !user.isAuthenticated"
64+
ng-show="features.analyticsEnabled" ng-class="{ active: $state.includes('home.analytics') }">
5965
<a ui-sref="home.analytics.tabs.dashboard">Analytics</a>
6066
</li>
6167
<li ng-class="{ active: $state.includes('home.about') }">
@@ -64,7 +70,7 @@
6470
<li ng-if="user.authenticationEnabled"
6571
class="dropdown"><a data-target="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span><b class="caret"></b></a>
6672
<ul class="dropdown-menu">
67-
<li ng-if="user.isAuthenticated"><a href="/logout">Logout</a></li>
73+
<li ng-if="user.isAuthenticated"><a ui-sref="logout">Logout</a></li>
6874
<li ng-if="!user.isAuthenticated"><a ui-sref="login">Login</a></li>
6975
</ul>
7076
</li>

ui/app/logout-success-oauth.html

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!doctype html>
2+
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3+
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4+
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5+
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6+
<head>
7+
<meta charset="utf-8">
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
9+
<title>Spring Cloud Data Flow - Logout</title>
10+
<meta name="description" content="">
11+
<meta name="viewport" content="width=device-width">
12+
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
13+
<!-- build:css({.tmp,app}) styles/main.css -->
14+
<link rel="stylesheet" href="styles/main.css">
15+
<!-- endbuild -->
16+
</head>
17+
<body>
18+
19+
<!--[if lt IE 7]>
20+
<p>You are using an <strong>outdated</strong> browser. Please upgrade your browser to improve your experience.</p>
21+
<![endif]-->
22+
<nav class="navbar navbar-default" role="navigation">
23+
<div class="container">
24+
<div class="navbar-header">
25+
<a class="navbar-brand" href="/dashboard"><span></span></a>
26+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
27+
<span class="sr-only">Toggle navigation</span>
28+
<span class="icon-bar"></span>
29+
<span class="icon-bar"></span>
30+
<span class="icon-bar"></span>
31+
</button>
32+
</div>
33+
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
34+
<ul class="nav navbar-nav navbar-right">
35+
<li>
36+
<a href="/dashboard">Login</a>
37+
</li>
38+
</ul>
39+
</div>
40+
</div>
41+
</nav>
42+
<div class="container-fluid homepage-billboard">
43+
<div class="row">
44+
<div class="homepage-title--container">
45+
<div class="homepage-title">Spring Cloud Data Flow Dashboard</div>
46+
<div class="homepage-subtitle--container desktop-only">
47+
</div>
48+
</div>
49+
<div class="platform--wrapper">
50+
<div class="platform--title">Logged Out</div>
51+
<div class="platform--text">
52+
<div class="container-fluid">
53+
<div class="row">
54+
<div class="col-md-8 col-md-offset-2">
55+
<p class="inverted">
56+
You have successfully logged out from the Spring Cloud Data Flow Dashboard.
57+
</p>
58+
<p class="inverted">
59+
Please keep in mind that you are most likely still logged in with your oauth
60+
provider. Therefore, going to the main Dashboard URL will log you back in,
61+
unless you also log out from your oauth provider.
62+
</p>
63+
</div>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
</div>
69+
</div>
70+
</body>
71+
</html>

ui/app/logout-success.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@
5555
<p class="inverted">
5656
You have successfully logged out from the Spring Cloud Data Flow Dashboard.
5757
</p>
58-
<p class="inverted">
59-
Please keep in mind that you are most likely still logged in with your oauth
60-
provider. Therefore, going to the main Dashboard URL will log you back in,
61-
unless you also log out from your oauth provider.
62-
</p>
6358
</div>
6459
</div>
6560
</div>

ui/app/scripts/auth/controllers/login.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ define([], function () {
3131
utils.addBusyPromise(authenticationPromise);
3232
authenticationPromise.then(
3333
function(response) {
34-
$log.info(response.data);
35-
$log.info($scope.loginForm);
3634
$rootScope.user.username = $scope.loginForm.username;
3735
$rootScope.user.isAuthenticated = true;
36+
$rootScope.user.isFormLogin = true;
3837
$http.defaults.headers.common[$rootScope.xAuthTokenHeaderName] = response.data;
3938

4039
utils.growl.success('User ' + $scope.loginForm.username + ' logged in.');

ui/app/scripts/auth/controllers/logout.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,32 @@
2121
*/
2222
define([], function () {
2323
'use strict';
24-
return ['$window', 'DataflowUtils', '$state', '$log', '$rootScope', '$http', function ($window, DataflowUtils, $state, $log, $rootScope, $http) {
24+
return ['$window', 'DataflowUtils', '$state', '$log', '$rootScope', '$http', 'userService', function ($window, DataflowUtils, $state, $log, $rootScope, $http, user) {
2525
$log.info('Logging out...');
26-
$http.get($rootScope.dataflowServerUrl + '/dashboard/logout');
2726

28-
$rootScope.user = {
29-
authenticationEnabled: true,
30-
isAuthenticated: false,
31-
username: ''
32-
};
27+
if ($rootScope.user.isFormLogin) {
28+
$http.get($rootScope.dataflowServerUrl + '/dashboard/logout').then(function() {
3329

34-
delete $http.defaults.headers.common[$rootScope.xAuthTokenHeaderName];
35-
DataflowUtils.growl.success('Logged out.');
36-
$state.go('login');
30+
$rootScope.user.username = '';
31+
$rootScope.user.isAuthenticated = false;
32+
$rootScope.user.isFormLogin = false;
33+
34+
user = {
35+
authenticationEnabled: true,
36+
isFormLogin: false,
37+
isAuthenticated: false,
38+
username: ''
39+
};
40+
41+
delete $http.defaults.headers.common[$rootScope.xAuthTokenHeaderName];
42+
DataflowUtils.growl.success('Logged out.');
43+
$state.go('login');
44+
});
45+
}
46+
else{
47+
var logoutUrl = '//' + $window.location.host + '/logout';
48+
console.log('Redirecting to ' + logoutUrl);
49+
$window.open(logoutUrl, '_self');
50+
}
3751
}];
3852
});

ui/app/scripts/auth/services.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ define(['angular'], function (angular) {
2828
var user = {
2929
authenticationEnabled: securityInfo.authenticationEnabled,
3030
isAuthenticated: securityInfo.authenticated,
31-
username: securityInfo.username
31+
username: securityInfo.username,
32+
isFormLogin: false
3233
};
3334
return user;
3435
})

ui/app/scripts/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ define([
147147
promiseFeature.then(function(featuresResponse) {
148148
app.constant('featuresInfo', featuresResponse.data);
149149
startApp();
150-
}, function() {
151-
console.error('Cannot load enabled features info. Application cannot be loaded.');
150+
}, function(errorResponse) {
151+
console.error('Cannot load enabled features info. Application cannot be loaded.', errorResponse);
152152
});
153153
}, function(errorResponse) {
154154
var errorMessage = 'Error retrieving security info from ' + securityInfoUrl + ' (timeout: ' + timeout + 'ms)';

ui/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"angular-bootstrap": "0.13.4",
1212
"angular-ui-indeterminate": "1.0.0",
1313
"angular-animate": "1.3.5",
14-
"angular-ui-router": "0.2.13",
14+
"angular-ui-router": "0.3.1",
1515
"angular-busy": "4.1.2",
1616
"angular-growl-v2": "0.7.2",
1717
"angular-highlightjs": "0.3.2",

0 commit comments

Comments
 (0)