mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
Merge pull request #1170 from tboerger/feature/logout-button
Integrated logout button into the UI
This commit is contained in:
commit
292c8b7c2b
@ -6,10 +6,10 @@
|
||||
$scope.user = payload.data;
|
||||
});
|
||||
|
||||
$scope.number = $stateParams.number || undefined;
|
||||
$scope.owner = $stateParams.owner || undefined;
|
||||
$scope.name = $stateParams.name || undefined;
|
||||
$scope.full_name = $scope.owner + '/' + $scope.name;
|
||||
$scope.number = $stateParams.number || undefined;
|
||||
$scope.owner = $stateParams.owner || undefined;
|
||||
$scope.name = $stateParams.name || undefined;
|
||||
$scope.full_name = $scope.owner + '/' + $scope.name;
|
||||
}
|
||||
|
||||
function UserLoginCtrl($scope, $window) {
|
||||
@ -18,6 +18,18 @@
|
||||
$scope.error = $window.location.hash.substr(7);
|
||||
}
|
||||
|
||||
function UserLogoutCtrl($scope, $window, $state) {
|
||||
// Remove login information from the local
|
||||
// storage and redirect to login page
|
||||
if (localStorage.hasOwnProperty("access_token")) {
|
||||
localStorage.removeItem("access_token");
|
||||
}
|
||||
|
||||
$state.go("login", {}, {
|
||||
location: "replace"
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* UserCtrl is responsible for managing user settings.
|
||||
*/
|
||||
@ -115,6 +127,7 @@
|
||||
.module('drone')
|
||||
.controller('UserHeaderCtrl', UserHeaderCtrl)
|
||||
.controller('UserLoginCtrl', UserLoginCtrl)
|
||||
.controller('UserLogoutCtrl', UserLogoutCtrl)
|
||||
.controller('UserCtrl', UserCtrl)
|
||||
.controller('UsersCtrl', UsersCtrl);
|
||||
})();
|
||||
|
@ -89,6 +89,17 @@
|
||||
},
|
||||
title: 'Login'
|
||||
})
|
||||
.state('logout', {
|
||||
url: '/logout',
|
||||
views: {
|
||||
'layout': {
|
||||
templateUrl: '/static/scripts/views/login.html',
|
||||
controller: 'UserLogoutCtrl',
|
||||
resolve: resolveUser
|
||||
}
|
||||
},
|
||||
title: 'Logout'
|
||||
})
|
||||
.state('app.profile', {
|
||||
url: '/profile',
|
||||
views: {
|
||||
|
@ -15,6 +15,7 @@
|
||||
<ul>
|
||||
<li><a href="/profile">Profile</a></li>
|
||||
<li><a href="/users">Users</a></li>
|
||||
<li><a href="/logout">Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@ -71,4 +72,4 @@ header li {
|
||||
.dropdown li > a:hover {
|
||||
background:#F5F7F9;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user