mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 12:21:03 +00:00
Merge pull request #558 from bradrydzewski/master
fixed logout now that we've moved to JWT tokens
This commit is contained in:
commit
90d8ba3941
6 changed files with 15 additions and 4 deletions
|
@ -43,6 +43,7 @@
|
||||||
<script src="/static/scripts/controllers/sync.js"></script>
|
<script src="/static/scripts/controllers/sync.js"></script>
|
||||||
<script src="/static/scripts/controllers/main.js"></script>
|
<script src="/static/scripts/controllers/main.js"></script>
|
||||||
<script src="/static/scripts/controllers/login.js"></script>
|
<script src="/static/scripts/controllers/login.js"></script>
|
||||||
|
<script src="/static/scripts/controllers/logout.js"></script>
|
||||||
<script src="/static/scripts/services/auth.js"></script>
|
<script src="/static/scripts/services/auth.js"></script>
|
||||||
<script src="/static/scripts/services/conf.js"></script>
|
<script src="/static/scripts/services/conf.js"></script>
|
||||||
<script src="/static/scripts/services/repo.js"></script>
|
<script src="/static/scripts/services/repo.js"></script>
|
||||||
|
|
|
@ -41,7 +41,12 @@ app.config(['$routeProvider', '$locationProvider', '$httpProvider', function($ro
|
||||||
.when('/login', {
|
.when('/login', {
|
||||||
templateUrl: '/static/views/login.html',
|
templateUrl: '/static/views/login.html',
|
||||||
controller: 'LoginController',
|
controller: 'LoginController',
|
||||||
title: 'Login',
|
title: 'Login'
|
||||||
|
})
|
||||||
|
.when('/logout', {
|
||||||
|
templateUrl: '/static/views/logout.html',
|
||||||
|
controller: 'LogoutController',
|
||||||
|
title: 'Logout'
|
||||||
})
|
})
|
||||||
.when('/gitlab', {
|
.when('/gitlab', {
|
||||||
templateUrl: '/static/views/login_gitlab.html',
|
templateUrl: '/static/views/login_gitlab.html',
|
||||||
|
|
7
server/app/scripts/controllers/logout.js
Normal file
7
server/app/scripts/controllers/logout.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('app').controller("LogoutController", function() {
|
||||||
|
console.log("logging out")
|
||||||
|
localStorage.removeItem("access_token");
|
||||||
|
window.location.href = "/login";
|
||||||
|
});
|
|
@ -7,5 +7,5 @@
|
||||||
<li ng-if="user.admin == true"><a href="/admin/users"><i class="fa fa-users"></i> Users</a></li>
|
<li ng-if="user.admin == true"><a href="/admin/users"><i class="fa fa-users"></i> Users</a></li>
|
||||||
<li ng-if="user.admin == true"><a href="/admin/settings"><i class="fa fa-cog"></i> Settings</a></li>
|
<li ng-if="user.admin == true"><a href="/admin/settings"><i class="fa fa-cog"></i> Settings</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<a href="/logout" class="signout" target="_self">Signout <i class="fa fa-sign-out"></i></a>
|
<a href="/logout" class="signout">Signout <i class="fa fa-sign-out"></i></a>
|
||||||
</div>
|
</div>
|
0
server/app/views/logout.html
Normal file
0
server/app/views/logout.html
Normal file
|
@ -66,7 +66,6 @@ func (c *Channel) start() {
|
||||||
case sub := <-c.unsubscribe:
|
case sub := <-c.unsubscribe:
|
||||||
delete(c.subscriptions, sub)
|
delete(c.subscriptions, sub)
|
||||||
close(sub.send)
|
close(sub.send)
|
||||||
log.Println("usubscribed to subscription")
|
|
||||||
|
|
||||||
case sub := <-c.subscribe:
|
case sub := <-c.subscribe:
|
||||||
c.subscriptions[sub] = true
|
c.subscriptions[sub] = true
|
||||||
|
@ -118,7 +117,6 @@ func replay(s *Subscription, history []interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Channel) stop() {
|
func (c *Channel) stop() {
|
||||||
log.Println("subscription stopped")
|
|
||||||
for sub := range c.subscriptions {
|
for sub := range c.subscriptions {
|
||||||
sub.Close()
|
sub.Close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue