(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
This commit is contained in:
antisnatchor
2011-05-18 12:18:00 +00:00
parent a41de931df
commit c5db1d4c87

View File

@@ -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: '<b>ERROR</b>: 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();
});