aboutsummaryrefslogtreecommitdiff
path: root/web/Login.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 22:50:05 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-29 22:50:05 +1200
commit2b0610469c10f99dd21393cbbed81a9d0d06b868 (patch)
treefcdb5a0717c1190561c2251184a2a2782ca0c129 /web/Login.js
parent2cb4c8c48fc01b7fadccbedecafe672853b22639 (diff)
downloadtrackermap-server-2b0610469c10f99dd21393cbbed81a9d0d06b868.tar.gz
trackermap-server-2b0610469c10f99dd21393cbbed81a9d0d06b868.tar.bz2
trackermap-server-2b0610469c10f99dd21393cbbed81a9d0d06b868.zip
Use Enter button to login
Diffstat (limited to 'web/Login.js')
-rw-r--r--web/Login.js45
1 files changed, 30 insertions, 15 deletions
diff --git a/web/Login.js b/web/Login.js
index f31b2c728..6fef9ce9d 100644
--- a/web/Login.js
+++ b/web/Login.js
@@ -41,21 +41,20 @@ Ext.define('LoginForm', {
}, {
text: Strings.login_login,
handler: function() {
- var win = this.up('window');
- var form = this.up('form').getForm();
- if (form.isValid()) {
- form.submit({
- success: function(form, action) {
- win.close();
- Ext.create('MainView', { renderTo: document.body });
- },
- failure: function(form, action) {
- Ext.Msg.alert(Strings.login_title, Strings.login_failed);
- }
- });
- }
+ this.up('window').submit();
}
- }]
+ }],
+
+ listeners: {
+ afterRender: function(){
+ this.keyNav = Ext.create('Ext.util.KeyNav', this.el, {
+ enter: function() {
+ this.up('window').submit();
+ },
+ scope: this
+ });
+ }
+ }
});
Ext.define('Login', {
@@ -65,5 +64,21 @@ Ext.define('Login', {
title: Strings.login_title,
closable: false,
- items: [{ xtype: 'login-form' }]
+ items: [{ xtype: 'login-form' }],
+
+ submit: function() {
+ var win = this;
+ var form = this.down('form').getForm();
+ if (form.isValid()) {
+ form.submit({
+ success: function() {
+ win.close();
+ Ext.create('MainView', { renderTo: document.body });
+ },
+ failure: function() {
+ Ext.Msg.alert(Strings.login_title, Strings.login_failed);
+ }
+ });
+ }
+ }
});