diff --git a/deluge/ui/web/js/deluge-login.js b/deluge/ui/web/js/deluge-login.js index 3ddcdd5f2..55cb72c73 100644 --- a/deluge/ui/web/js/deluge-login.js +++ b/deluge/ui/web/js/deluge-login.js @@ -1,18 +1,4 @@ Deluge.Login = { - Form: new Ext.form.FormPanel({ - defaultType: 'textfield', - id: 'loginForm', - baseCls: 'x-plain', - labelWidth: 55, - items: [{ - fieldLabel: _('Password'), - id: 'password', - name: 'password', - inputType: 'password', - anchor: '100%' - }] - }), - onLogin: function() { var passwordField = Deluge.Login.Form.items.get('password'); Deluge.Client.web.login(passwordField.getValue(), { @@ -30,9 +16,33 @@ Deluge.Login = { } } }); + }, + + onKey: function(field, e) { + if (e.getKey() == 13) Deluge.Login.onLogin(); } } +Deluge.Login.Form = new Ext.form.FormPanel({ + defaultType: 'textfield', + id: 'loginForm', + baseCls: 'x-plain', + labelWidth: 55, + items: [{ + fieldLabel: _('Password'), + id: 'password', + name: 'password', + inputType: 'password', + anchor: '100%', + listeners: { + 'specialkey': { + fn: Deluge.Login.onKey, + scope: Deluge.Login + } + } + }] +}); + Deluge.Login.Window = new Ext.Window({ layout: 'fit', width: 300,