1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| {
text: 'Connexion',
id: 'ConnectBtn',
cls: 'x-btn-text-icon',
icon: 'client/img/icons/accept.png',
handler: function(){
if( Ext.getCmp('AuthLogin').getValue() == '' || Ext.getCmp('AuthPass').getValue() == ''){
Ext.Msg.show({
id:'AlertAuth',
title:'Attention',
msg: 'Veuillez remplir tous les champs',
buttons: Ext.Msg.OK,
fn: function(value)
{
if(value=='ok')
{
Ext.Msg.hide();
}
}
});
return;
}
Ext.getCmp('form-statusbar').showBusy('Connexion...');
Ext.Ajax.request({
url: '/Gestionnaire_de_courrier/server/json/Authentication.php',
method: 'POST',
params: {
action : "Auth",
LOGIN : Ext.getCmp('AuthLogin').getValue(),
PASSWORD : Ext.getCmp('AuthPass').getValue()
},
success: function(response) {
Users = Ext.util.JSON.decode(response.responseText);
Ext.getCmp('Access').setValue(Users.Users.ID);
if(Ext.getCmp('Access').getValue() !== ''){
AuthWin.close();
tabs.show();
}
if(Users.Users.length != '0'){
AuthWin.close();
//tabs.show();
access = 1;
window.location.href ='index.html';
}
//else if(Users.Users.ID)
},
failure: function() {
Ext.Msg.show({
id:'AlertAuth1',
title:'Connexion refusée',
msg: 'Le mot de passe ou le login est incorrect',
buttons: Ext.Msg.OK,
fn: function(value)
{
if(value=='ok')
{
Ext.Msg.hide();
}
}
});
//return;
}
});
}
} |
Partager