[add] Login functionality

This commit is contained in:
Jose Pabl Domingo Aramburo Sanchez 2018-08-09 01:28:36 -06:00
parent 8a2d5b2afa
commit 23868b60ee
6 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,81 @@
body {
background: url(../imagenes/grey_background.jpg);
background-size: cover;
font-family: Montserrat;
}
@media only screen and (min-device-width: 480px) {
body {
background: url('../imagenes/grey_background.jpg') no-repeat fixed center center;
}
}
.logo {
width: 213px;
height: 60px;
margin: 30px auto;
}
.login-block {
width: 320px;
padding: 20px;
background: #fff;
border-radius: 5px;
border-top: 5px solid #bdb035;
margin: 0 auto;
}
.login-block h1 {
text-align: center;
color: #000;
font-size: 18px;
text-transform: uppercase;
margin-top: 0;
margin-bottom: 20px;
}
.login-block input {
width: 100%;
height: 42px;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 20px;
font-size: 14px;
font-family: Montserrat;
padding: 0 20px 0 50px;
outline: none;
}
.login-block input#user {
background: #fff url('../imagenes/login_username.png') 20px top no-repeat;
background-size: 16px 80px;
}
.login-block input#user:focus {
background: #fff url('../imagenes/login_username.png') 20px bottom no-repeat;
background-size: 16px 80px;
}
.login-block input#password {
background: #fff url('../imagenes/login_password.png') 20px top no-repeat;
background-size: 16px 80px;
}
.login-block input#password:focus {
background: #fff url('../imagenes/login_password.png') 20px bottom no-repeat;
background-size: 16px 80px;
}
.login-block input:active, .login-block input:focus {
border: 1px solid #bdb035;
}
.login-block #loginButon {
width: 100%;
height: 40px;
background: #bdb035;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid #6d661c;
color: #fff;
font-weight: bold;
text-transform: uppercase;
font-size: 14px;
font-family: Montserrat;
outline: none;
cursor: pointer;
}
.login-block button:hover {
background: #c7b935;
border: 1px solid #6d661c;
}

View File

@ -0,0 +1,25 @@
<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>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<div class="container">
<div class="logo"></div>
<div class="login-block">
<form action="" method="post" name="Login_Form" class="login">
<h1>Login</h1>
<input type="text" value="" placeholder="User" id="userName" name="user" required="" autofocus=""/>
<input type="password" value="" placeholder="Password" id="password" name="password" required=""/>
<a href="#" class="btn btn-lg btn-warning btn-default" id="loginButon" name="login" value="Login" onclick="processLogin();">Login</a>
</form>
</div>
</div>
<div id="modals">
</div>
<script src="../js/login.js"></script>
<link href="../css/login.css" rel="stylesheet">

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,28 @@
function getbaseUrl(uriPath){
var url = window.location.href;
return url.substring(0, url.indexOf(uriPath));
}
function processLogin() {
console.log(getbaseUrl('html/'));
var parametros = {
"userName":$('#userName').val(),
"password":$('#password').val()
};
$.ajax({
url: getbaseUrl('/html/') + '/index.php/api/session/login',
type: 'POST',
dataType: 'json',
data: parametros,
success:function(data){
console.log(JSON.stringify(data))
},
error:function(x,e,h) {
console.log(x);
console.log(e + " " + h);
},
});
}