2018-11-05 10:06:39 +00:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
no-return-assign,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-05-19 09:02:56 +00:00
|
|
|
import App from '../base'
|
2021-03-26 09:52:52 +00:00
|
|
|
import getMeta from '../utils/meta'
|
2018-11-05 10:06:39 +00:00
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
export default App.controller(
|
|
|
|
'ClearSessionsController',
|
|
|
|
function ($scope, $http) {
|
|
|
|
$scope.state = {
|
|
|
|
otherSessions: getMeta('ol-otherSessions'),
|
|
|
|
error: false,
|
2021-04-27 07:52:58 +00:00
|
|
|
success: false,
|
2021-04-14 13:17:21 +00:00
|
|
|
}
|
2020-05-19 09:02:56 +00:00
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
return ($scope.clearSessions = function () {
|
|
|
|
console.log('>> clearing all sessions')
|
|
|
|
return $http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/user/sessions/clear',
|
2021-04-27 07:52:58 +00:00
|
|
|
headers: { 'X-CSRF-Token': window.csrfToken },
|
2020-05-19 09:02:56 +00:00
|
|
|
})
|
2021-04-14 13:17:21 +00:00
|
|
|
.then(function () {
|
|
|
|
$scope.state.otherSessions = []
|
|
|
|
$scope.state.error = false
|
|
|
|
return ($scope.state.success = true)
|
|
|
|
})
|
|
|
|
.catch(() => ($scope.state.error = true))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
)
|