From e8850343bdb1e5e6a1c366aeacdff1f91bfa5daf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 17 Nov 2016 22:48:33 +1300 Subject: Add user expiration and device limit --- web/app/view/UserDialog.js | 24 ++++++++++++++++++++++-- web/app/view/UserDialogController.js | 7 +++++-- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 479d66dc..a54a20c6 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -47,14 +47,14 @@ Ext.define('Traccar.view.UserDialog', { name: 'readonly', fieldLabel: Strings.serverReadonly, allowBlank: false, - disabled: true, + hidden: true, reference: 'readonlyField' }, { xtype: 'checkboxfield', name: 'admin', fieldLabel: Strings.userAdmin, allowBlank: false, - disabled: true, + hidden: true, reference: 'adminField' }, { xtype: 'combobox', @@ -110,6 +110,26 @@ Ext.define('Traccar.view.UserDialog', { displayField: 'name', valueField: 'key', editable: false + }, { + xtype: 'checkboxfield', + name: 'disabled', + fieldLabel: Strings.userDisabled, + hidden: true, + reference: 'disabledField' + }, { + xtype: 'datefield', + name: 'expirationTime', + fieldLabel: Strings.userExpirationTime, + disabled: true, + reference: 'expirationTimeField', + startDay: Traccar.Style.weekStartDay, + format: Traccar.Style.dateFormat + }, { + xtype: 'numberfield', + name: 'deviceLimit', + fieldLabel: Strings.userDeviceLimit, + disabled: true, + reference: 'deviceLimitField' }] }, diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index 7c5cebd8..cd0a9512 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -21,8 +21,11 @@ Ext.define('Traccar.view.UserDialogController', { init: function () { if (Traccar.app.getUser().get('admin')) { - this.lookupReference('adminField').setDisabled(false); - this.lookupReference('readonlyField').setDisabled(false); + this.lookupReference('adminField').setHidden(false); + this.lookupReference('readonlyField').setHidden(false); + this.lookupReference('disabledField').setHidden(false); + this.lookupReference('expirationTimeField').setDisabled(false); + this.lookupReference('deviceLimitField').setDisabled(false); } }, -- cgit v1.2.3 From f6294d79414299fc7e58c0a64545625c6301ec47 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 18 Nov 2016 00:16:55 +1300 Subject: Check account on every call --- web/app/view/LoginController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js index fbc703e9..436a1532 100644 --- a/web/app/view/LoginController.js +++ b/web/app/view/LoginController.js @@ -50,7 +50,11 @@ Ext.define('Traccar.view.LoginController', { this.fireViewEvent('login'); } else { this.getView().setVisible(true); - Traccar.app.showError(Strings.loginFailed); + if (response.status === 401) { + Traccar.app.showError(Strings.loginFailed); + } else { + Traccar.app.showError(response.responseText); + } } } }); -- cgit v1.2.3