mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-03 06:08:42 +00:00
Integrated logout button into the UI
This commit is contained in:
parent
d1b36e868a
commit
2577b6cda2
3 changed files with 30 additions and 5 deletions
|
@ -18,6 +18,18 @@
|
||||||
$scope.error = $window.location.hash.substr(7);
|
$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.
|
* UserCtrl is responsible for managing user settings.
|
||||||
*/
|
*/
|
||||||
|
@ -115,6 +127,7 @@
|
||||||
.module('drone')
|
.module('drone')
|
||||||
.controller('UserHeaderCtrl', UserHeaderCtrl)
|
.controller('UserHeaderCtrl', UserHeaderCtrl)
|
||||||
.controller('UserLoginCtrl', UserLoginCtrl)
|
.controller('UserLoginCtrl', UserLoginCtrl)
|
||||||
|
.controller('UserLogoutCtrl', UserLogoutCtrl)
|
||||||
.controller('UserCtrl', UserCtrl)
|
.controller('UserCtrl', UserCtrl)
|
||||||
.controller('UsersCtrl', UsersCtrl);
|
.controller('UsersCtrl', UsersCtrl);
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -89,6 +89,17 @@
|
||||||
},
|
},
|
||||||
title: 'Login'
|
title: 'Login'
|
||||||
})
|
})
|
||||||
|
.state('logout', {
|
||||||
|
url: '/logout',
|
||||||
|
views: {
|
||||||
|
'layout': {
|
||||||
|
templateUrl: '/static/scripts/views/login.html',
|
||||||
|
controller: 'UserLogoutCtrl',
|
||||||
|
resolve: resolveUser
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: 'Logout'
|
||||||
|
})
|
||||||
.state('app.profile', {
|
.state('app.profile', {
|
||||||
url: '/profile',
|
url: '/profile',
|
||||||
views: {
|
views: {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/profile">Profile</a></li>
|
<li><a href="/profile">Profile</a></li>
|
||||||
<li><a href="/users">Users</a></li>
|
<li><a href="/users">Users</a></li>
|
||||||
|
<li><a href="/logout">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue