Use session cookies and store filter settings in sessionStorage
This commit is contained in:
parent
a716910b63
commit
acb5a6dcf9
@ -178,7 +178,6 @@ OpenSlides uses the following projects or parts of them:
|
|||||||
* `angular-bootstrap <http://angular-ui.github.io/bootstrap>`_, License: MIT
|
* `angular-bootstrap <http://angular-ui.github.io/bootstrap>`_, License: MIT
|
||||||
* `angular-bootstrap-colorpicker <https://github.com/buberdds/angular-bootstrap-colorpicker>`_, License: MIT
|
* `angular-bootstrap-colorpicker <https://github.com/buberdds/angular-bootstrap-colorpicker>`_, License: MIT
|
||||||
* `angular-chosen-localytics <http://github.com/leocaseiro/angular-chosen>`_, License: MIT
|
* `angular-chosen-localytics <http://github.com/leocaseiro/angular-chosen>`_, License: MIT
|
||||||
* `angular-cookies <https://github.com/angular/bower-angular-cookies>`_, License: MIT
|
|
||||||
* `angular-csv-import <https://github.com/bahaaldine/angular-csv-import>`_, License: MIT
|
* `angular-csv-import <https://github.com/bahaaldine/angular-csv-import>`_, License: MIT
|
||||||
* `angular-formly <http://formly-js.github.io/angular-formly/>`_, License: MIT
|
* `angular-formly <http://formly-js.github.io/angular-formly/>`_, License: MIT
|
||||||
* `angular-formly-templates-bootstrap <https://github.com/formly-js/angular-formly-templates-bootstrap>`_, License: MIT
|
* `angular-formly-templates-bootstrap <https://github.com/formly-js/angular-formly-templates-bootstrap>`_, License: MIT
|
||||||
@ -206,6 +205,7 @@ OpenSlides uses the following projects or parts of them:
|
|||||||
* `lodash <https://lodash.com/>`_, License: MIT
|
* `lodash <https://lodash.com/>`_, License: MIT
|
||||||
* `ng-dialog <https://github.com/likeastore/ngDialog>`_, License: MIT
|
* `ng-dialog <https://github.com/likeastore/ngDialog>`_, License: MIT
|
||||||
* `ng-file-upload <https://github.com/danialfarid/ng-file-upload>`_, License: MIT
|
* `ng-file-upload <https://github.com/danialfarid/ng-file-upload>`_, License: MIT
|
||||||
|
* `ngStorage <https://github.com/gsklee/ngStorage>`_, License: MIT
|
||||||
* `ngbootbox <https://github.com/eriktufvesson/ngBootbox>`_, License: MIT
|
* `ngbootbox <https://github.com/eriktufvesson/ngBootbox>`_, License: MIT
|
||||||
* `open-sans-fontface <https://github.com/FontFaceKit/open-sans>`_, License: Apache License version 2.0
|
* `open-sans-fontface <https://github.com/FontFaceKit/open-sans>`_, License: Apache License version 2.0
|
||||||
* `pdfjs-dist <http://mozilla.github.io/pdf.js/>`_, License: Apache-2.0
|
* `pdfjs-dist <http://mozilla.github.io/pdf.js/>`_, License: Apache-2.0
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
"angular-bootstrap-colorpicker": "~3.0.25",
|
"angular-bootstrap-colorpicker": "~3.0.25",
|
||||||
"angular-chosen-localytics": "~1.5.0",
|
"angular-chosen-localytics": "~1.5.0",
|
||||||
"angular-csv-import": "0.0.36",
|
"angular-csv-import": "0.0.36",
|
||||||
"angular-cookies": "~1.5.9",
|
|
||||||
"angular-file-saver": "~1.1.2",
|
"angular-file-saver": "~1.1.2",
|
||||||
"angular-formly": "~8.4.0",
|
"angular-formly": "~8.4.0",
|
||||||
"angular-formly-templates-bootstrap": "~6.2.0",
|
"angular-formly-templates-bootstrap": "~6.2.0",
|
||||||
@ -33,6 +32,7 @@
|
|||||||
"lodash": "~4.16.0",
|
"lodash": "~4.16.0",
|
||||||
"ng-dialog": "~0.6.4",
|
"ng-dialog": "~0.6.4",
|
||||||
"ng-file-upload": "~11.2.3",
|
"ng-file-upload": "~11.2.3",
|
||||||
|
"ngstorage": "~0.3.11",
|
||||||
"ngBootbox": "~0.1.3",
|
"ngBootbox": "~0.1.3",
|
||||||
"pdfmake-dist": "~0.1.27",
|
"pdfmake-dist": "~0.1.27",
|
||||||
"open-sans-fontface": "https://github.com/OpenSlides/open-sans.git#1.4.2.post1",
|
"open-sans-fontface": "https://github.com/OpenSlides/open-sans.git#1.4.2.post1",
|
||||||
|
@ -140,7 +140,7 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
// Filtering
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('AgendaTableFilter');
|
$scope.filter = osTableFilter.createInstance('AgendaTableFilter');
|
||||||
|
|
||||||
if (!$scope.filter.existsCookie()) {
|
if (!$scope.filter.existsStorageEntry()) {
|
||||||
$scope.filter.booleanFilters = {
|
$scope.filter.booleanFilters = {
|
||||||
closed: {
|
closed: {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
@ -155,8 +155,6 @@ angular.module('OpenSlidesApp.agenda.site', [
|
|||||||
choiceNo: gettext('No internal items'),
|
choiceNo: gettext('No internal items'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.filter.save();
|
|
||||||
}
|
}
|
||||||
$scope.filter.propertyList = ['item_number', 'title', 'title_list_view', 'comment', 'duration'];
|
$scope.filter.propertyList = ['item_number', 'title', 'title_list_view', 'comment', 'duration'];
|
||||||
$scope.filter.propertyFunctionList = [
|
$scope.filter.propertyFunctionList = [
|
||||||
|
@ -323,7 +323,7 @@ angular.module('OpenSlidesApp.assignments.site', [
|
|||||||
// Filtering
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('AssignmentTableFilter');
|
$scope.filter = osTableFilter.createInstance('AssignmentTableFilter');
|
||||||
|
|
||||||
if (!$scope.filter.existsCookie()) {
|
if (!$scope.filter.existsStorageEntry()) {
|
||||||
$scope.filter.multiselectFilters = {
|
$scope.filter.multiselectFilters = {
|
||||||
tag: [],
|
tag: [],
|
||||||
phase: [],
|
phase: [],
|
||||||
|
@ -19,7 +19,7 @@ angular.module('OpenSlidesApp.core', [
|
|||||||
'$httpProvider',
|
'$httpProvider',
|
||||||
function($httpProvider) {
|
function($httpProvider) {
|
||||||
// Combine the django csrf system with the angular csrf system
|
// Combine the django csrf system with the angular csrf system
|
||||||
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
|
$httpProvider.defaults.xsrfCookieName = 'OpenSlidesCsrfToken';
|
||||||
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
|
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
@ -13,11 +13,11 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
'formlyBootstrap',
|
'formlyBootstrap',
|
||||||
'localytics.directives',
|
'localytics.directives',
|
||||||
'ngBootbox',
|
'ngBootbox',
|
||||||
'ngCookies',
|
|
||||||
'ngDialog',
|
'ngDialog',
|
||||||
'ngFileSaver',
|
'ngFileSaver',
|
||||||
'ngMessages',
|
'ngMessages',
|
||||||
'ngCsvImport',
|
'ngCsvImport',
|
||||||
|
'ngStorage',
|
||||||
'ui.tinymce',
|
'ui.tinymce',
|
||||||
'luegg.directives',
|
'luegg.directives',
|
||||||
'xeditable',
|
'xeditable',
|
||||||
@ -343,6 +343,13 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
.config([
|
||||||
|
'$sessionStorageProvider',
|
||||||
|
function ($sessionStorageProvider) {
|
||||||
|
$sessionStorageProvider.setKeyPrefix('OpenSlides');
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
// Helper to add ui.router states at runtime.
|
// Helper to add ui.router states at runtime.
|
||||||
// Needed for the django url_patterns.
|
// Needed for the django url_patterns.
|
||||||
.provider('runtimeStates', [
|
.provider('runtimeStates', [
|
||||||
@ -371,25 +378,25 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
* - propertyList, propertyFunctionList, propertyDict: See function getObjectQueryString
|
* - propertyList, propertyFunctionList, propertyDict: See function getObjectQueryString
|
||||||
*/
|
*/
|
||||||
.factory('osTableFilter', [
|
.factory('osTableFilter', [
|
||||||
'$cookies',
|
'$sessionStorage',
|
||||||
function ($cookies) {
|
function ($sessionStorage) {
|
||||||
var createInstance = function (cookieName) {
|
var createInstance = function (tableName) {
|
||||||
var self = {
|
var self = {
|
||||||
multiselectFilters: {},
|
multiselectFilters: {},
|
||||||
booleanFilters: {},
|
booleanFilters: {},
|
||||||
filterString: '',
|
filterString: '',
|
||||||
};
|
};
|
||||||
var existsCookie = function () {
|
var existsStorageEntry = function () {
|
||||||
return $cookies.getObject(cookieName);
|
return $sessionStorage[tableName];
|
||||||
};
|
};
|
||||||
var cookie = existsCookie();
|
var storage = existsStorageEntry();
|
||||||
if (cookie) {
|
if (storage) {
|
||||||
self = cookie;
|
self = storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.existsCookie = existsCookie;
|
self.existsStorageEntry = existsStorageEntry;
|
||||||
self.save = function () {
|
self.save = function () {
|
||||||
$cookies.putObject(cookieName, self);
|
$sessionStorage[tableName] = self;
|
||||||
};
|
};
|
||||||
self.areFiltersSet = function () {
|
self.areFiltersSet = function () {
|
||||||
var areFiltersSet = _.find(self.multiselectFilters, function (filterList) {
|
var areFiltersSet = _.find(self.multiselectFilters, function (filterList) {
|
||||||
|
@ -101,6 +101,12 @@ SESSION_ENGINE = 'openslides.core.session_backend'
|
|||||||
|
|
||||||
SESSION_COOKIE_NAME = 'OpenSlidesSessionID'
|
SESSION_COOKIE_NAME = 'OpenSlidesSessionID'
|
||||||
|
|
||||||
|
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||||
|
|
||||||
|
CSRF_COOKIE_NAME = 'OpenSlidesCsrfToken'
|
||||||
|
|
||||||
|
CSRF_COOKIE_AGE = None
|
||||||
|
|
||||||
PASSWORD_HASHERS = [
|
PASSWORD_HASHERS = [
|
||||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||||
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
||||||
|
@ -101,7 +101,7 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
|
|||||||
// Filtering
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('MediafilesTableFilter');
|
$scope.filter = osTableFilter.createInstance('MediafilesTableFilter');
|
||||||
|
|
||||||
if (!$scope.filter.existsCookie()) {
|
if (!$scope.filter.existsStorageEntry()) {
|
||||||
$scope.filter.booleanFilters = {
|
$scope.filter.booleanFilters = {
|
||||||
isPrivate: {
|
isPrivate: {
|
||||||
value: undefined,
|
value: undefined,
|
||||||
|
@ -824,7 +824,7 @@ angular.module('OpenSlidesApp.motions.site', [
|
|||||||
// Filtering
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('MotionTableFilter');
|
$scope.filter = osTableFilter.createInstance('MotionTableFilter');
|
||||||
|
|
||||||
if (!$scope.filter.existsCookie()) {
|
if (!$scope.filter.existsStorageEntry()) {
|
||||||
$scope.filter.multiselectFilters = {
|
$scope.filter.multiselectFilters = {
|
||||||
state: [],
|
state: [],
|
||||||
category: [],
|
category: [],
|
||||||
|
@ -512,7 +512,7 @@ angular.module('OpenSlidesApp.users.site', [
|
|||||||
// Filtering
|
// Filtering
|
||||||
$scope.filter = osTableFilter.createInstance('UserTableFilter');
|
$scope.filter = osTableFilter.createInstance('UserTableFilter');
|
||||||
|
|
||||||
if (!$scope.filter.existsCookie()) {
|
if (!$scope.filter.existsStorageEntry()) {
|
||||||
$scope.filter.multiselectFilters = {
|
$scope.filter.multiselectFilters = {
|
||||||
group: [],
|
group: [],
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user