aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-18 19:12:43 +1300
committerGitHub <noreply@github.com>2016-11-18 19:12:43 +1300
commita252dbe43512c75afd4a17075b834f767576fd28 (patch)
tree71f45f133227df64b203bf3ded83f35b30f12691
parent469869d4c01cd5385acee0c84faa226775454e79 (diff)
parentf6294d79414299fc7e58c0a64545625c6301ec47 (diff)
downloadtrackermap-web-a252dbe43512c75afd4a17075b834f767576fd28.tar.gz
trackermap-web-a252dbe43512c75afd4a17075b834f767576fd28.tar.bz2
trackermap-web-a252dbe43512c75afd4a17075b834f767576fd28.zip
Merge pull request #322 from tananaev/users
Add user expiration and device limit
-rw-r--r--web/app/Application.js2
-rw-r--r--web/app/model/User.js10
-rw-r--r--web/app/view/LoginController.js6
-rw-r--r--web/app/view/UserDialog.js24
-rw-r--r--web/app/view/UserDialogController.js7
-rw-r--r--web/l10n/en.json3
6 files changed, 46 insertions, 6 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 702a75a9..6f4cb1dd 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -130,7 +130,7 @@ Ext.define('Traccar.Application', {
if (Ext.isString(response)) {
Ext.Msg.alert(Strings.errorTitle, response);
} else if (response.responseText) {
- Ext.Msg.alert(response.responseText);
+ Ext.Msg.alert(Strings.errorTitle, response.responseText);
} else if (response.statusText) {
Ext.Msg.alert(Strings.errorTitle, response.statusText);
} else {
diff --git a/web/app/model/User.js b/web/app/model/User.js
index 56748e45..48912417 100644
--- a/web/app/model/User.js
+++ b/web/app/model/User.js
@@ -62,6 +62,16 @@ Ext.define('Traccar.model.User', {
name: 'coordinateFormat',
type: 'string'
}, {
+ name: 'disabled',
+ type: 'boolean'
+ }, {
+ name: 'expirationTime',
+ type: 'date',
+ dateFormat: 'c'
+ }, {
+ name: 'deviceLimit',
+ type: 'int'
+ }, {
name: 'attributes'
}],
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);
+ }
}
}
});
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);
}
},
diff --git a/web/l10n/en.json b/web/l10n/en.json
index ee6bef81..bcbfa169 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -47,6 +47,9 @@
"userPassword": "Password",
"userAdmin": "Admin",
"userRemember": "Remember",
+ "userDisabled": "Disabled",
+ "userExpirationTime": "Expiration",
+ "userDeviceLimit": "Device Limit",
"loginTitle": "Login",
"loginLanguage": "Language",
"loginRegister": "Register",