Fix updating sessions after logout session

This commit is contained in:
Stian Thorgersen 2014-05-22 14:51:36 +01:00
parent 74e2bfd9bd
commit 86ad7292af
2 changed files with 10 additions and 11 deletions

View file

@ -107,7 +107,7 @@ module.controller('UserSessionsCtrl', function($scope, realm, user, sessions, Us
$scope.logoutAll = function() { $scope.logoutAll = function() {
UserLogout.save({realm : realm.realm, user: user.username}, function () { UserLogout.save({realm : realm.realm, user: user.username}, function () {
Notifications.success('Logged out user in all applications'); Notifications.success('Logged out user in all applications');
UserSessions.get({realm: realm.realm, user: user.username}, function(updated) { UserSessions.query({realm: realm.realm, user: user.username}, function(updated) {
$scope.sessions = updated; $scope.sessions = updated;
}) })
}); });
@ -116,9 +116,9 @@ module.controller('UserSessionsCtrl', function($scope, realm, user, sessions, Us
$scope.logoutSession = function(sessionId) { $scope.logoutSession = function(sessionId) {
console.log('here in logoutSession'); console.log('here in logoutSession');
UserSessionLogout.delete({realm : realm.realm, session: sessionId}, function() { UserSessionLogout.delete({realm : realm.realm, session: sessionId}, function() {
Notifications.success('Logged out session'); UserSessions.query({realm: realm.realm, user: user.username}, function(updated) {
UserSessions.get({realm: realm.realm, user: user.username}, function(updated) {
$scope.sessions = updated; $scope.sessions = updated;
Notifications.success('Logged out session');
}) })
}); });
} }

View file

@ -38,19 +38,18 @@
<td>{{session.ipAddress}}</td> <td>{{session.ipAddress}}</td>
<td>{{session.start | date:'medium'}}</td> <td>{{session.start | date:'medium'}}</td>
<td>{{session.lastAccess | date:'medium'}}</td> <td>{{session.lastAccess | date:'medium'}}</td>
<td><ul style="list-style: none; "> <td>
<li data-ng-repeat="app in session.applications"> <div data-ng-repeat="app in session.applications">
<a href="#/realms/{{realm.realm}}/applications/{{app}}/sessions">{{app}}</a> <a href="#/realms/{{realm.realm}}/applications/{{app}}/sessions">{{app}}</a>
</li> </div>
</ul> </ul>
</td> </td>
<td><ul style="list-style: none; "> <td>
<li data-ng-repeat="(clientId, clientName) in session.clients"> <div data-ng-repeat="(clientId, clientName) in session.clients">
<a href="#/realms/{{realm.realm}}/oauth-clients/{{clientId}}">{{clientName}}</a> <a href="#/realms/{{realm.realm}}/oauth-clients/{{clientId}}">{{clientName}}</a>
</li> </div>
</ul>
</td> </td>
<td><a ng-click="logoutSession(session.id)">logout</a> </td> <td><a href="" ng-click="logoutSession(session.id)">logout</a> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>