-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
155 lines (138 loc) · 5.15 KB
/
index.php
File metadata and controls
155 lines (138 loc) · 5.15 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?php
session_start();
if(isset($_SESSION['sesion_aprenDigital'])){
header("Location: dashboard.php");
}
require_once 'controllers/controller.php';
require_once 'config/db.php';
require_once 'models/helpers.php';
?>
<!DOCTYPE html>
<html lang="es">
<head>
<title><?php echo APP_TITLE ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta name="author" content="Oscar Rojas O."/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<meta name="robots" content="Index, Follow">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="theme-color" content="#0A2558">
<!---------------- favicon ---------------->
<link rel="icon" href="../assets/img/logo.ico" type="image/ico">
<!---------------- estilos ---------------->
<link rel="stylesheet" href="assets/css/dashboard.css">
<link rel="stylesheet" href="assets/css/eapdstyles.css">
<link rel="stylesheet" href="assets/css/css/all.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/datatables.min.css"/>
<!---------------- jquery ---------------->
<script type="text/javascript" src="assets/js/jquery.js"></script>
</head>
<body></body>
<div class="container-wrap login-escuela">
<div class="w50 box-imagen">
<img src="../assets/img/logo.png" alt="" class="img-login">
</div>
<div class="w50 box-formulario-login">
<div class="box-title">
<h1 class="title">Formulario de Ingreso</h1>
</div>
<form action="models/login.php" method="post" id="form" class="form" autocomplete="off">
<?php if(isset($_SESSION['error_login'])) :?>
<div class="alerta-error">
<?=$_SESSION['error_login'];?>
</div>
<?php endif; ?>
<div class="box-input inputEmail">
<input type="text" name="email" class="input w100" id="email" placeholder="Ingresa tu Email" onkeydown="validaemail()" required>
<div class="icon"><i class="fas fa-user"></i></div>
<div class="toggle toggle-user">
<span id="span1" class="none"><i class="fas fa-check-circle"></i></span>
<span id="span2" ><i class="fas fa-times-circle"></i></span>
</div>
<span class="erroremail" id="erroremail"></span>
</div>
<div class="box-input inputBox">
<input type="password" name="password" id="password" class="input w100" placeholder="Ingresa tu Contraseña" onkeyup="lengthpassword()" required>
<div class="icon"><i class="fas fa-lock"></i></div>
<div class="toggle toggle-pass" onclick="showHide()">
<span id="span3"><i class="far fa-eye-slash"></i></span>
<span id="span4" class="none"><i class="far fa-eye"></i> </span>
</div>
</div>
<div class="field">
<a href="recuperar-cuenta.php" class="link">¿Olvide mi contraseña?</a>
</div>
<div class="box-buttons">
<input type="submit" name="submit" value="Ingresar" class="btn btn-azul">
<label for="register" class="register">¡No estoy registrado! </label>
<a href="../form-alumno.php" class="link">Registrarme</a>
</div>
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript">
/**
* VALIDACIONES DEL LOGIN
* */
function validaemail(){
const form = document.getElementById("form"),
email = document.getElementById("email").value,
emailLenght = email.length,
span1 = document.querySelector('#span1'),
span2 = document.querySelector('#span2'),
toggle = document.querySelector('.toggle-user'),
erroremail = document.getElementById("erroremail");
let pattern = /^[^ ]+@[^ ]+\.[a-z]{2,3}$/;
if(emailLenght >= 1){
toggle.classList.add("active");
}
if(email.match(pattern)){
form.classList.add("valido");
span1.classList.remove("none");
span2.classList.add("none");
form.classList.remove("invalido");
erroremail.innerHTML = "";
}else{
form.classList.remove("valido");
form.classList.add("invalido");
span1.classList.add("none");
span2.classList.remove("none");
erroremail.innerHTML = "El correo no es valido!";
erroremail.style.color = "#ff0000";
}
if(email == ""){
form.classList.remove("valido");
form.classList.remove("invalido");
erroremail.innerHTML = "";
erroremail.style.color = "#ff0000";
}
}
function lengthpassword(){
const password2 = document.getElementById('password').value,
password2length = password2.length,
toggle = document.querySelector('.toggle-pass');
if(password2length >= 1){
toggle.classList.add("active");
}else{
toggle.classList.remove("active");
}
}
const password = document.getElementById('password'),
span3 = document.querySelector('#span3'),
span4 = document.querySelector('#span4');
function showHide(){
if(password.type == 'password'){
password.setAttribute('type','text');
span3.style.display = "none";
span4.style.display = "block";
}else{
password.setAttribute('type','password');
span3.style.display = "block";
span4.style.display = "none";
}
}
</script>