From c5db1d4c874053b064fcb63f064a9838d7bafdba Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Wed, 18 May 2011 12:18:00 +0000 Subject: [PATCH] (Fixes issue 169), (Fixes issue 170): remove MessageBoxes using inline auth error/load handling git-svn-id: https://beef.googlecode.com/svn/trunk@976 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- .../media/javascript/ui/authentication.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/extensions/admin_ui/media/javascript/ui/authentication.js b/extensions/admin_ui/media/javascript/ui/authentication.js index 7229c6fa8..d1a0012e5 100644 --- a/extensions/admin_ui/media/javascript/ui/authentication.js +++ b/extensions/admin_ui/media/javascript/ui/authentication.js @@ -1,20 +1,20 @@ Ext.onReady(function() { - var bd = Ext.getBody(); - - submitAuthForm = function() { + submitAuthForm = function() { login_form.getForm().submit({ - waitMsg: 'Logging in ...', + success: function() { window.location.href = '/ui/panel' }, failure: function() { - Ext.MessageBox.alert('Message', 'Error with username or password') + if(Ext.get('loginError') == null){ + Ext.DomHelper.insertAfter('loadingError', {id:'loginError', html: 'ERROR: invalid username or password'}); + } + login_form.mask.hide(); } }); } - var login_form = new Ext.form.FormPanel({ url: 'authentication/login', @@ -24,7 +24,8 @@ Ext.onReady(function() { title: 'Authentication', bodyStyle:'padding:5px 5px 0', width: 350, - + + defaults: { width: 175, inputType: 'password' @@ -60,13 +61,17 @@ Ext.onReady(function() { buttons: [{ text: 'Login', - handler: function() { + id: 'loginButton', + handler: function() { + login_form.mask = new Ext.LoadMask('login_form', {msg:"Authenticating to BeEF..."}); + login_form.mask.show(); submitAuthForm(); } }] }); login_form.render('centered'); + Ext.DomHelper.append('login_form', {tag: 'div', id: 'loadingError'}); document.getElementById('user').focus(); });