-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecordar.php
129 lines (107 loc) · 4.17 KB
/
recordar.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
include_once('config.php');
$a = (isset($_GET['a'])) ? $_GET['a'] : '';
$b = (isset($_GET['b'])) ? $_GET['b'] : '';
$email = base64_decode($a);
$title = 'Recuperar Contraseña P&G';
?>
<!doctype html>
<html class="no-js" lang="es">
<head>
<?php include_once('code/header.php'); ?>
</head>
<body class="bgAzukMain">
<main id="page" role="main" class="main full100">
<!-- REGISTRO -->
<section>
<div class="row pTop1">
<div class="small-11 medium-8 large-6 small-centered medium-centered large-centered columns">
<img src="static/images/isotipo.png" alt="P&G">
<h1 class="blanco">RECUPERAR CONTRASEÑA</h1>
<?php if ( strlen($a)<3 ) { ?>
<p>Escribe tu email para enviarte un link para restablecer tu contraseña</p>
<div class="row collapse postfix-round">
<div class="small-9 columns">
<input id="txtEmail" type="email" placeholder="Correo" class="transparent azulSub" aria-label="Correo" tabindex="1" />
</div>
<div class="small-3 columns">
<a href="#" class="button postfix transparent fs15"><span class="lnr lnr-envelope"></span></a>
</div>
</div><br/>
<a href="#" class="small round button success" tabindex="2" data-reveal-id="myBlock">RECUPERAR</a><br/>
<?php } else { ?>
<p>Escribe tu nueva contraseña para <?php print($email); ?></p>
<form id="frmChangePass">
<div class="row collapse postfix-round">
<div class="small-9 columns">
<input id="txtPass1" type="password" placeholder="Contraseña" class="transparent azulSub" aria-label="Contraseña" tabindex="1" required />
</div>
<div class="small-3 columns">
<a href="#" class="button postfix transparent fs15"><i class="fa fa-lock"></i></a>
</div>
</div>
<div class="row collapse postfix-round">
<div class="small-9 columns">
<input id="txtPass2" type="password" placeholder="Repetir Contraseña" class="transparent azulSub" aria-label="Contraseña" tabindex="2" required />
</div>
<div class="small-3 columns">
<a href="#" class="button postfix transparent fs15"><i class="fa fa-lock"></i></a>
</div>
</div><br/>
<div class="row collapse">
<button id="cmdGuardarPass" class="medium round button success" tabindex="3">GUARDAR</button>
<span id="msgbox"></span><br/>
</div>
</form>
<?php } ?>
</div>
</div>
</section>
</main>
<?php include_once('code/script.php'); ?>
<script>
$(document).on('ready', iniciar);
var ajaxReq = "jupiter/api.php";
var auth = 0;
var a = "<?php print($a); ?>"
var b = "<?php print($b); ?>"
function iniciar(){
$(document).foundation();
$("#frmChangePass").on("submit", function(event){
event.preventDefault();
sendChangePass();
});
};
function sendChangePass(){
var pass1 = $("#txtPass1").val();
var pass2 = $("#txtPass2").val();
if (pass1 !== pass2){
$('#msgbox').html('<i class="fa fa-exclamation-triangle"></i> Error: Las Contraseñas no coinciden.');
return false;
}
$('#msgbox').html('<i class="fa fa-cog fa-spin"></i> Procesando ...');
$.post(ajaxReq, {action:"userChangePass", eAuth:auth, eVarA:a, eVarB:b, ePass:pass1, rand:Math.random()},
function(data){
if ( data.status == 'ok' ){
// OK!
$('#msgbox').html('¡Felicitaciones! Su contraseña ha sido actualizada.');
window.setTimeout(slowLogin, 6000);
limpiar();
} else {
//$('#msgbox').html('Msg: [ ' + data.info + ' ]');
$('#msgbox').html('Error: Error General');
}
});
};
function slowLogin(){
window.location.href = '/';
};
function limpiar () {
$('#frmRegistro input').removeClass('err');
$('#txtPass1').val('');
$('#txtPass2').val('');
$('#txtPass1').focus();
};
</script>
</body>
</html>