-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·106 lines (97 loc) · 2.92 KB
/
index.php
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
session_start();
if(isset($_SESSION['id']))
header("location: principal.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Fluxo de Caixa</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="app/ux/Ext.ux.plugin.FormEnter.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
Ext.QuickTips.init();
var login = Ext.create('Ext.FormPanel', {
labelWidth : 50,
url : 'php/login.php?acao=login',
frame : true,
defaultType : 'textfield',
monitorValid : true,
plugins : [{
ptype: 'formenter'
}],
items : [{
fieldLabel : 'E-mail',
vtype : 'email',
name : 'email',
blankText : 'Por favor, informe o seu e-mail',
width : 250,
allowBlank : false
},{
fieldLabel : 'Senha',
name : 'senha',
width : 250,
inputType : 'password',
blankText : 'Por favor, informe a sua senha',
allowBlank : false
}],
buttons : [{
text : 'Entrar',
formBind : true,
handler : facaLogin
}]
});
var win = Ext.create("Ext.Window",{
layout : 'fit',
title : 'Acesso ao Fluxo de Caixa',
width : 280,
height : 140,
y : 250,
closable : false,
resizable : false,
draggable : false,
plain : true,
border : false,
items : [login]
});
win.show();
function facaLogin() {
if(login.getForm().isValid())
{
login.getForm().submit({
method : 'POST',
waitTitle : 'Por favor, aguarde!!!',
waitMsg : 'Autenticado no sistema',
success : function(){
login.getForm().reset();
var redirect = 'principal.php';
window.location = redirect;
},
failure : function(form, action){
if(action.failureType === 'server'){
obj = Ext.decode(action.response.responseText);
Ext.Msg.show({
title : 'Erro no login',
msg : obj.erro.motivo,
buttons : Ext.Msg.OK,
icon : Ext.MessageBox.ERROR,
scope : this,
width : 150
});
}
else
{
Ext.Msg.alert('ERRO NO CLIENTE', 'Passe esta mensagem para o suporte: ' + action.response.responseText);
}
login.getForm().reset();
}
});
}
}
});
</script>
</head>
<body></body>
</html>