- Increase token length

- Make not editable
- Add clear trigger
This commit is contained in:
Abyss777 2016-11-20 09:25:32 +05:00
parent d8e0a38c66
commit b11bed89bf
2 changed files with 10 additions and 1 deletions

View File

@ -136,10 +136,15 @@ Ext.define('Traccar.view.UserDialog', {
reference: 'tokenField',
fieldLabel: Strings.userToken,
disabled: true,
editable: false,
triggers: {
generate: {
cls: 'iconCls: x-fa fa-refresh',
handler: 'generateToken'
},
clear: {
cls: 'iconCls: x-fa fa-remove',
handler: 'clearToken'
}
}
}]

View File

@ -35,13 +35,17 @@ Ext.define('Traccar.view.UserDialogController', {
generateToken: function () {
var i, newToken = '';
for (i = 0; i < 16; i++) {
for (i = 0; i < 20; i++) {
newToken += this.symbols.charAt(Math.floor(Math.random() * this.symbols.length));
}
this.lookupReference('tokenField').setValue(newToken);
},
clearToken: function () {
this.lookupReference('tokenField').setValue('');
},
onSaveClick: function (button) {
var dialog, record, store;
dialog = button.up('window').down('form');