diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/Login.js | 6 | ||||
-rw-r--r-- | web/app/view/LoginController.js | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/web/app/view/Login.js b/web/app/view/Login.js index 085f853be..4876e928c 100644 --- a/web/app/view/Login.js +++ b/web/app/view/Login.js @@ -54,7 +54,7 @@ Ext.define('Traccar.view.Login', { }, { xtype: 'textfield', name: 'email', - id: 'txtUser', + reference: 'txtUser', fieldLabel: Strings.userEmail, allowBlank: false, enableKeyEvents: true, @@ -66,7 +66,7 @@ Ext.define('Traccar.view.Login', { }, { xtype: 'textfield', name: 'password', - id: 'txtPassword', + reference: 'txtPassword', fieldLabel: Strings.userPassword, inputType: 'password', allowBlank: false, @@ -77,7 +77,7 @@ Ext.define('Traccar.view.Login', { inputAttrTpl: ['autocomplete="on"'] }, { xtype: 'checkboxfield', - id: 'chkRememberMe', + reference: 'chkRememberMe', fieldLabel: Strings.rememberMe }, { xtype: 'component', diff --git a/web/app/view/LoginController.js b/web/app/view/LoginController.js index 3b4fc8754..c33af328e 100644 --- a/web/app/view/LoginController.js +++ b/web/app/view/LoginController.js @@ -29,8 +29,8 @@ Ext.define('Traccar.view.LoginController', { var user = Ext.util.Cookies.get('user'); var pass = Ext.util.Cookies.get('pass'); if (user && pass) { - Ext.getCmp('txtUser').setValue(user); - Ext.getCmp('txtPassword').setValue(pass); + this.lookupReference('txtUser').setValue(user); + this.lookupReference('txtPassword').setValue(pass); this.login(); } }, @@ -47,9 +47,9 @@ Ext.define('Traccar.view.LoginController', { callback: function (options, success, response) { Ext.getBody().unmask(); if (success) { - if (Ext.getCmp('chkRememberMe').getValue()) { - Ext.util.Cookies.set('user', Ext.getCmp('txtUser').getValue(), Ext.Date.add(new Date(), Ext.Date.YEAR, 1)); - Ext.util.Cookies.set('pass', Ext.getCmp('txtPassword').getValue(), Ext.Date.add(new Date(), Ext.Date.YEAR, 1)); + if (this.lookupReference('chkRememberMe').getValue()) { + Ext.util.Cookies.set('user', this.lookupReference('txtUser').getValue(), Ext.Date.add(new Date(), Ext.Date.YEAR, 1)); + Ext.util.Cookies.set('pass', this.lookupReference('txtPassword').getValue(), Ext.Date.add(new Date(), Ext.Date.YEAR, 1)); } Traccar.app.setUser(Ext.decode(response.responseText)); this.fireViewEvent('login'); |