[add] Error handling in the login
This commit is contained in:
parent
0449f202ef
commit
6d29ac3f23
@ -1,8 +1,11 @@
|
||||
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
|
||||
<!-- jQuery library -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
|
||||
<!-- Latest compiled JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
|
||||
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
|
||||
<div class="container">
|
||||
@ -17,8 +20,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modals">
|
||||
<div id="modalLoginError" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" id="modalLoginErrorHeader">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title"><center>Ha ocurrido un error</center></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p id="modalLoginErrorBody"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="../js/login.js"></script>
|
||||
|
@ -16,13 +16,19 @@ console.log(getbaseUrl('html/'));
|
||||
dataType: 'json',
|
||||
data: parametros,
|
||||
success:function(data){
|
||||
console.log(JSON.stringify(data))
|
||||
|
||||
|
||||
console.log(JSON.stringify(data));
|
||||
if(data["status"] == "success"){
|
||||
console.log("yhi");
|
||||
}else if(data["status"] == "success" || (data["status"] === undefined)){
|
||||
$('#modalLoginError').modal('show');
|
||||
document.getElementById('modalLoginErrorBody').innerHTML = "The server didn't respond in time, please try again or refresh this page.";
|
||||
}
|
||||
},
|
||||
error:function(x,e,h) {
|
||||
console.log(x);
|
||||
console.log(e + " " + h);
|
||||
error:function(x) {
|
||||
if (x.status==500){
|
||||
$('#modalLoginError').modal('show');
|
||||
document.getElementById('modalLoginErrorBody').innerHTML = "The user or password didnt match, please try again";
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user