Compare commits
15 Commits
landingPag
...
interactio
| Author | SHA1 | Date | |
|---|---|---|---|
| d4fadf08bc | |||
| de84da4482 | |||
| 697d0fe769 | |||
| cb5d30b4e0 | |||
| 6c91cad46c | |||
| ccd9e10351 | |||
| 231e7fe2e6 | |||
| f820a22a4f | |||
| 0cdfd21fa2 | |||
| fee3db486f | |||
| 87181696e1 | |||
| 8b22c0db9c | |||
| 18ee0ad333 | |||
| 4928481f72 | |||
|
|
2d11218076 |
@@ -1 +1,2 @@
|
||||
Options -Indexes
|
||||
Deny from all
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
# Stage 1 - the build process
|
||||
FROM composer:1.7.1 as build-deps
|
||||
ENV COMPOSER_ALLOW_SUPERUSER 1
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
COPY . .
|
||||
RUN composer install
|
||||
RUN composer test
|
||||
|
||||
# Stage 2 - the production environment
|
||||
FROM ubuntu:16.04
|
||||
|
||||
# Updating
|
||||
RUN apt-get -y update && apt-get -y upgrade
|
||||
|
||||
# Installing php, apache and supplementary software
|
||||
RUN apt-get -y install apache2 php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip curl git unzip composer
|
||||
RUN apt-get -y install apache2 \
|
||||
php7.0 \
|
||||
libapache2-mod-php7.0 \
|
||||
php7.0-cli \
|
||||
php7.0-common \
|
||||
php7.0-mbstring \
|
||||
php7.0-gd \
|
||||
php7.0-intl \
|
||||
php7.0-xml \
|
||||
php7.0-mysql \
|
||||
php7.0-mcrypt
|
||||
|
||||
# Enable apache mods
|
||||
RUN a2enmod php7.0
|
||||
@@ -20,24 +39,14 @@ ENV APACHE_RUN_GROUP www-data
|
||||
ENV APACHE_LOG_DIR /var/log/apache2
|
||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||
|
||||
# Expose apache
|
||||
EXPOSE 80
|
||||
|
||||
# Copy this repo into place.
|
||||
ADD . /var/www/site
|
||||
WORKDIR /var/www/site
|
||||
COPY --from=build-deps /root .
|
||||
|
||||
# Testing permisions
|
||||
RUN chmod 777 -R .
|
||||
RUN touch logs/app.log
|
||||
RUN chmod 777 logs/app.log
|
||||
|
||||
# Installing dependencies
|
||||
RUN composer install
|
||||
# Update the default apache site
|
||||
ADD docker/apache-config.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
# Unit tests
|
||||
RUN composer test
|
||||
|
||||
# Update the default apache site with the config we created.
|
||||
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
|
||||
# By default start up apache in the foreground, override with /bin/bash for interative
|
||||
# By default start up apache in the foreground
|
||||
CMD /usr/sbin/apache2ctl -D FOREGROUND
|
||||
|
||||
0
api-payroll/logs/app.log
Executable file
0
api-payroll/logs/app.log
Executable file
@@ -1,3 +1,5 @@
|
||||
allow from all
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
body {
|
||||
background-color: #e3e3e3;
|
||||
/* Se agrego color blanco a letra en panel en general*/
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/*Cambia el color del date picker a negro para permitir su visibilidad*/
|
||||
.datepicker{
|
||||
color: black;
|
||||
}
|
||||
|
||||
/*El color con el que se muestra el peso del archivo en la carga masiva se imagenes*/
|
||||
.size{
|
||||
color: black;
|
||||
}
|
||||
|
||||
.calendar{
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
#cuerpo{
|
||||
top:17%;
|
||||
left:1%;
|
||||
@@ -78,7 +67,6 @@ body {
|
||||
}
|
||||
|
||||
|
||||
/* botoner<65>a panel principal */
|
||||
.metro{
|
||||
width:auto;
|
||||
height:auto;
|
||||
@@ -199,7 +187,7 @@ body {
|
||||
}
|
||||
}
|
||||
|
||||
/* FORMATO PARA TEXTO CUSTOM */
|
||||
|
||||
.formato_texto_custom{
|
||||
width: 97%;
|
||||
float: left;
|
||||
@@ -18,7 +18,7 @@ body {
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 5px;
|
||||
border-top: 5px solid #bdb035;
|
||||
border-top: 5px solid #5bc0de;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.login-block h1 {
|
||||
@@ -58,15 +58,15 @@ body {
|
||||
background-size: 16px 80px;
|
||||
}
|
||||
.login-block input:active, .login-block input:focus {
|
||||
border: 1px solid #bdb035;
|
||||
border: 1px solid #5bc0de;
|
||||
}
|
||||
.login-block #loginButon {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
background: #bdb035;
|
||||
background: #009bad;
|
||||
box-sizing: border-box;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #6d661c;
|
||||
border: 1px solid #000;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
@@ -75,7 +75,7 @@ body {
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.login-block button:hover {
|
||||
background: #c7b935;
|
||||
border: 1px solid #6d661c;
|
||||
|
||||
#modalLoginErrorHeader{
|
||||
background-color: #d9534f;
|
||||
}
|
||||
@@ -1,3 +1,12 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['userName'])){
|
||||
header("Location: ./login.php");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="../css/bootstrap.min.css">
|
||||
|
||||
@@ -38,7 +47,7 @@
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="../logout.php"><span class="fa fa-fw fa-power-off"></span> Cerrar Sesión</a>
|
||||
<a href="#" onclick="logout();"><span class="fa fa-fw fa-power-off"></span> Cerrar Sesión</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -229,4 +238,6 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<link href="../css/panel.css" rel="stylesheet">
|
||||
<script src="../js/getBaseUrl.js"></script>
|
||||
<script src="../js/landing.js"></script>
|
||||
<link href="../css/landing.css" rel="stylesheet">
|
||||
@@ -1,3 +1,12 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if(isset($_SESSION['userName'])){
|
||||
header("Location: ./landing.php");
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="../css/bootstrap.min.css">
|
||||
|
||||
@@ -41,4 +50,5 @@
|
||||
</div>
|
||||
|
||||
<script src="../js/login.js"></script>
|
||||
<script src="../js/getBaseUrl.js"></script>
|
||||
<link href="../css/login.css" rel="stylesheet">
|
||||
10
api-payroll/public/js/getBaseUrl.js
Normal file
10
api-payroll/public/js/getBaseUrl.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Returns the entry point url for the system, this url will be used
|
||||
* to access both the api and the static resources
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
function getbaseUrl(){
|
||||
var url = window.location.href;
|
||||
return url.substring(0, url.indexOf('/html/'));
|
||||
}
|
||||
18
api-payroll/public/js/landing.js
Normal file
18
api-payroll/public/js/landing.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function logout() {
|
||||
var baseUrl = getbaseUrl();
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/api/session/logout',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success:function(data){
|
||||
window.location.replace(baseUrl + '/html/login.php');
|
||||
},
|
||||
error:function(x) {
|
||||
if (x.status==500){
|
||||
$('#modalLoginError').modal('show');
|
||||
document.getElementById('modalLoginErrorBody').innerHTML = "The user or password didnt match, please try again";
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,25 +1,38 @@
|
||||
function getbaseUrl(uriPath){
|
||||
var url = window.location.href;
|
||||
return url.substring(0, url.indexOf(uriPath));
|
||||
/**
|
||||
* Maps the enter key to the login action
|
||||
*/
|
||||
$(document).keypress(function(e) {
|
||||
if(e.which == 13) {
|
||||
processLogin();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Takes the input from the username and password fields and send theem to the backend
|
||||
* to be validated
|
||||
*
|
||||
* The response from the api will contain a status that will determine if the login was
|
||||
* successful or not and a message that will contain feedback which can be used to
|
||||
* display errors to the user
|
||||
*/
|
||||
function processLogin() {
|
||||
var baseUrl = getbaseUrl('/html/');
|
||||
var baseUrl = getbaseUrl();
|
||||
|
||||
var parametros = {
|
||||
var parameters = {
|
||||
"userName":$('#userName').val(),
|
||||
"password":$('#password').val()
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/index.php/api/session/login',
|
||||
url: baseUrl + '/api/session/login',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: parametros,
|
||||
data: parameters,
|
||||
success:function(data){
|
||||
console.log(JSON.stringify(data));
|
||||
if(data["status"] == "success"){
|
||||
redirect(baseUrl + '/html/landing.php');
|
||||
window.location.replace(baseUrl + '/html/landing.php');
|
||||
|
||||
}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.";
|
||||
@@ -33,7 +46,3 @@ function processLogin() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function redirect(url){
|
||||
window.location.replace(url);
|
||||
}
|
||||
@@ -117,12 +117,12 @@ class SessionApplication{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
function destroySession(){
|
||||
session_destroy();
|
||||
|
||||
return "Sucessfully logged out.";
|
||||
return array('status' => 'success', 'message' => 'Successfully logged out.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -6,7 +6,7 @@ services:
|
||||
ports:
|
||||
- "8085:80"
|
||||
volumes:
|
||||
- api-payroll:/var/www/site
|
||||
- ./volumes/apache-logs:/var/log/apache2
|
||||
depends_on:
|
||||
- mysql
|
||||
mysql:
|
||||
@@ -18,11 +18,11 @@ services:
|
||||
ports:
|
||||
- "3307:3307"
|
||||
volumes:
|
||||
- my-datavolume:/var/lib/mysql
|
||||
- ./volumes/mysql-data:/var/lib/mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: '12345678'
|
||||
MYSQL_USER: 'sloth'
|
||||
MYSQL_PASS: '12345678'
|
||||
volumes:
|
||||
api-payroll:
|
||||
my-datavolume:
|
||||
mysql-data:
|
||||
apache-logs:
|
||||
|
||||
2
volumes/.gitignore
vendored
Normal file
2
volumes/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
mysql-data/
|
||||
apache-logs/
|
||||
1
volumes/README.md
Normal file
1
volumes/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# Do not delete this directory, it'll contain the volumes created by the containers
|
||||
Reference in New Issue
Block a user