diff --git a/app/controllers/admin_base_trait.php b/app/controllers/admin_base_trait.php index 46a4a3c..2abeb19 100644 --- a/app/controllers/admin_base_trait.php +++ b/app/controllers/admin_base_trait.php @@ -11,7 +11,7 @@ private function _init() { } public function before_filter() { - // Require_login(); + Require_login(); $this->menuLinks = adminMenu(); } diff --git a/app/controllers/index_controller.php b/app/controllers/index_controller.php new file mode 100644 index 0000000..aa74433 --- /dev/null +++ b/app/controllers/index_controller.php @@ -0,0 +1,47 @@ + 'login,logout,signin' + ]; + + public function __construct() { + $this->_init(); + } + + public function before_filter() { + Require_login(); + $this->menuLinks = generalMenu(); + } + + public function indexAction() { + $this->render = ['text'=>'noop']; + } + + public function loginAction() { + $this->layout = false; + } + public function signinAction() { + $code = HTTP_401; + + if (!empty($_POST['e']) and !empty($_POST['p'])): + $id = $this->User->login($_POST['e'], $_POST['p']); + $id > 0 and ($code = HTTP_202) and ($_SESSION['user'] = $id); + endif; + + http_response_code($code); + $this->respondToAJAX('{}'); + } + /** + * Destroy all registered information of a session and redirect to the login page. + */ + public function logoutAction() { + $this->layout = false; + php_sapi_name() !== 'cli' && session_destroy(); + $_SESSION = null; + unset($_SESSION); + header('Location: /index/login'); + } +} \ No newline at end of file diff --git a/app/helpers/Menu_Helper.php b/app/helpers/Menu_Helper.php index 5b51e9d..8bafe0b 100644 --- a/app/helpers/Menu_Helper.php +++ b/app/helpers/Menu_Helper.php @@ -33,6 +33,13 @@ function adminMenu() { return [ new menuEntry('/admin/index', 'Inicio', null, 'home'), new menuEntry('/admin/users', 'Usuarios', null, 'user'), - new menuEntry('/admin/logout?logout=1', 'Salir', null, 'exit') + new menuEntry('/index/logout?logout=1', 'Salir', null, 'exit') + ]; +} + +function generalMenu() { + return [ + new menuEntry('/index/index', 'Inicio', null, 'home'), + new menuEntry('/index/logout?logout=1', 'Salir', null, 'exit') ]; } \ No newline at end of file diff --git a/app/views/_footer-contents.phtml b/app/views/_footer-contents.phtml new file mode 100644 index 0000000..bf5a1e8 --- /dev/null +++ b/app/views/_footer-contents.phtml @@ -0,0 +1,17 @@ + + \ No newline at end of file diff --git a/app/views/_header-contents.phtml b/app/views/_header-contents.phtml new file mode 100644 index 0000000..a175bd6 --- /dev/null +++ b/app/views/_header-contents.phtml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + Basilisk + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/views/index/login.phtml b/app/views/index/login.phtml new file mode 100644 index 0000000..bb4d45c --- /dev/null +++ b/app/views/index/login.phtml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/views/layout.phtml b/app/views/layout.phtml index c699e2c..8978954 100644 --- a/app/views/layout.phtml +++ b/app/views/layout.phtml @@ -1,33 +1,14 @@ - - - - - Basilisk Project Management - - - - - - - - - - +
- + Menu
@@ -40,7 +21,7 @@ yield;?> - +

Menú

@@ -65,12 +46,6 @@
- + \ No newline at end of file diff --git a/app/webroot/css/styles.css b/app/webroot/css/styles.css index 773e106..2688c09 100644 --- a/app/webroot/css/styles.css +++ b/app/webroot/css/styles.css @@ -5,8 +5,8 @@ **/ :root { --primary: #16253F; - --primary-contrast: #1a1a1a; - --primary-hover: #CC660099; + --primary-contrast: #ffffff; + --primary-hover: #16253F99; --secondary: #182517; --secondary-contrast: #FAFBFC; --secondary-hover: #E8EBEF; @@ -1476,6 +1476,11 @@ dmb-login dmb-button { width: 90%; } +dmb-login svg { + height: auto; + width: 100%; +} + dmb-menu-button { top: 1em; left: 1.5em; diff --git a/app/webroot/images/basilisk.svg b/app/webroot/images/basilisk.svg new file mode 100644 index 0000000..56fc527 --- /dev/null +++ b/app/webroot/images/basilisk.svg @@ -0,0 +1,180 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/webroot/images/logo-114x114.png b/app/webroot/images/logo-114x114.png new file mode 100644 index 0000000..e126eca Binary files /dev/null and b/app/webroot/images/logo-114x114.png differ diff --git a/app/webroot/images/logo-120x120.png b/app/webroot/images/logo-120x120.png new file mode 100644 index 0000000..a143ccb Binary files /dev/null and b/app/webroot/images/logo-120x120.png differ diff --git a/app/webroot/images/logo-144x144.png b/app/webroot/images/logo-144x144.png new file mode 100644 index 0000000..54a5361 Binary files /dev/null and b/app/webroot/images/logo-144x144.png differ diff --git a/app/webroot/images/logo-152x152.png b/app/webroot/images/logo-152x152.png new file mode 100644 index 0000000..c1faa84 Binary files /dev/null and b/app/webroot/images/logo-152x152.png differ diff --git a/app/webroot/images/logo-16x16.png b/app/webroot/images/logo-16x16.png new file mode 100644 index 0000000..517c360 Binary files /dev/null and b/app/webroot/images/logo-16x16.png differ diff --git a/app/webroot/images/logo-180x180.png b/app/webroot/images/logo-180x180.png new file mode 100644 index 0000000..92cd757 Binary files /dev/null and b/app/webroot/images/logo-180x180.png differ diff --git a/app/webroot/images/logo-192x192.png b/app/webroot/images/logo-192x192.png new file mode 100644 index 0000000..7b0dfb7 Binary files /dev/null and b/app/webroot/images/logo-192x192.png differ diff --git a/app/webroot/images/logo-32x32.png b/app/webroot/images/logo-32x32.png new file mode 100644 index 0000000..2951101 Binary files /dev/null and b/app/webroot/images/logo-32x32.png differ diff --git a/app/webroot/images/logo-512x512.png b/app/webroot/images/logo-512x512.png new file mode 100644 index 0000000..5c78029 Binary files /dev/null and b/app/webroot/images/logo-512x512.png differ diff --git a/app/webroot/images/logo-57x57.png b/app/webroot/images/logo-57x57.png new file mode 100644 index 0000000..d84f239 Binary files /dev/null and b/app/webroot/images/logo-57x57.png differ diff --git a/app/webroot/images/logo-60x60.png b/app/webroot/images/logo-60x60.png new file mode 100644 index 0000000..d114592 Binary files /dev/null and b/app/webroot/images/logo-60x60.png differ diff --git a/app/webroot/images/logo-72x72.png b/app/webroot/images/logo-72x72.png new file mode 100644 index 0000000..256c63d Binary files /dev/null and b/app/webroot/images/logo-72x72.png differ diff --git a/app/webroot/images/logo-76x76.png b/app/webroot/images/logo-76x76.png new file mode 100644 index 0000000..bc0edde Binary files /dev/null and b/app/webroot/images/logo-76x76.png differ diff --git a/app/webroot/images/logo-96x96.png b/app/webroot/images/logo-96x96.png new file mode 100644 index 0000000..0765537 Binary files /dev/null and b/app/webroot/images/logo-96x96.png differ diff --git a/app/webroot/images/logo.svg b/app/webroot/images/logo.svg new file mode 100644 index 0000000..56fc527 --- /dev/null +++ b/app/webroot/images/logo.svg @@ -0,0 +1,180 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/webroot/manifest.json b/app/webroot/manifest.json new file mode 100644 index 0000000..56a0e5c --- /dev/null +++ b/app/webroot/manifest.json @@ -0,0 +1,60 @@ +{ + "name": "Basilisk Project Management", + "short_name": "Basilisk", + "display": "standalone", + "background_color": "white", + "orientation": "landscape", + "theme_color": "#e30a33", + "start_url": "/index/login", + "icons": [ + { + "src": "/images/logo-36x36.png", + "sizes": "36x36", + "type": "image/png", + "density": "0.75", + "purpose": "any maskable" + }, + { + "src": "/images/logo-48x48.png", + "sizes": "48x48", + "type": "image/png", + "density": "1.0", + "purpose": "any maskable" + }, + { + "src": "/images/logo-72x72.png", + "sizes": "72x72", + "type": "image/png", + "density": "1.5", + "purpose": "any maskable" + }, + { + "src": "/images/logo-96x96.png", + "sizes": "96x96", + "type": "image/png", + "density": "2.0", + "purpose": "any maskable" + }, + { + "src": "/images/logo-144x144.png", + "sizes": "144x144", + "type": "image/png", + "density": "3.0", + "purpose": "any maskable" + }, + { + "src": "/images/logo-192x192.png", + "sizes": "192x192", + "type": "image/png", + "density": "4.0", + "purpose": "any maskable" + }, + { + "src": "/images/logo-512x512.png", + "sizes": "512x512", + "type": "image/png", + "density": "4.0", + "purpose": "any maskable" + } + ] +} \ No newline at end of file diff --git a/app/webroot/sw.js b/app/webroot/sw.js new file mode 100644 index 0000000..b1447ad --- /dev/null +++ b/app/webroot/sw.js @@ -0,0 +1,116 @@ + +const version = '1.0'; +const cacheName = `uroboros-${version}`; +const urlBlacklist = [ + '/index/signin', + '/index/setsesion' +]; +const urls = [ + '/', + '/index/index', + '/index/login', + '/favicon.ico', + '/fonts/icomoon/icomoon.woff', + '/fonts/openSans/Regular/OpenSans-Regular.ttf' +]; + +function updateStaticCache() { + return caches.open(cacheName) + .then(cache => { + return cache.addAll(urls); + }); +} + +function clearOldCaches() { + return caches.keys().then(keys => { + return Promise.all( + keys + .filter(key => key.indexOf(cacheName) !== 0) + .map(key => caches.delete(key)) + ); + }); +} + +function isHtmlRequest(request) { + return request.headers.get('Accept').indexOf('text/html') !== -1; +} + +// function isJsonRequest(request) { +// return request.headers.get('Accept').indexOf('application/json') !== -1; +// } + +function isListed(url) { + return urls.filter(bl => url.indexOf(bl) == 0).length > 0; +} + +function isBlacklisted(url) { + return urlBlacklist.filter(bl => url.indexOf(bl) == 0).length > 0; +} + + +function isCachableResponse(response) { + return response && response.ok && response.headers.pragma && response.headers.pragma.toLowerCase() === 'cache'; +} + + +self.addEventListener('install', event => { + event.waitUntil( + updateStaticCache() + .then(() => self.skipWaiting()) + ); +}); + + +self.addEventListener('activate', event => { + event.waitUntil( + clearOldCaches() + .then(() => self.clients.claim()) + ); +}); + + +self.addEventListener('fetch', event => { + let request = event.request; + + if (request.method !== 'GET') { + if (!navigator.onLine && isHtmlRequest(request)) { + return event.respondWith(caches.match(urls)); + } + return; + } + if (isHtmlRequest(request)) { + event.respondWith( + fetch(request) + .then(response => { + if (isCachableResponse(response) && !isBlacklisted(response.url) && isListed(response.url)) { + let copy = response.clone(); + caches.open(cacheName).then(cache => cache.put(request, copy)); + } + return response; + }) + .catch(() => { + return caches.match(request) + .then(response => { + if (!response && request.mode == 'navigate') { + return caches.match(urls); + } + return response; + }); + }) + ); + } else if (event.request.cache === 'only-if-cached' && event.request.mode === 'same-origin') { + return event.respondWith( + caches.match(request) + .then(response => { + return response || fetch(request) + .then(response => { + if (isCachableResponse(response)) { + let copy = response.clone(); + caches.open(cacheName).then(cache => cache.put(request, copy)); + } + return response; + }); + }) + ); + } +}); \ No newline at end of file diff --git a/migrations/seeds.php b/migrations/seeds.php index ba034ad..b1fabc4 100644 --- a/migrations/seeds.php +++ b/migrations/seeds.php @@ -1,5 +1,18 @@ User->Find(array('fields'=>'id', 'conditions'=>"`email`='jserrano@muy.co'")); + 0 === $user->counter() and $this->User->Niu([ + 'email' => 'admin@admin.com', + 'firstname' => 'Admin', + 'lastname' => 'Admin', + 'password' => '1234567890', + 'status' => 1 + ])->Save() or die($user->_error); + } + + public function sow() { + $this->_sowAdmin(); + } } \ No newline at end of file diff --git a/ui-sources/components/dmb-login/dmb-login.scss b/ui-sources/components/dmb-login/dmb-login.scss index a2e8d94..8db7f72 100644 --- a/ui-sources/components/dmb-login/dmb-login.scss +++ b/ui-sources/components/dmb-login/dmb-login.scss @@ -16,4 +16,9 @@ dmb-login { margin: 0 5%; width: 90%; } + + svg { + height: auto; + width: 100%; + } } \ No newline at end of file diff --git a/ui-sources/styles.scss b/ui-sources/styles.scss index b8f61b3..b1f1fec 100755 --- a/ui-sources/styles.scss +++ b/ui-sources/styles.scss @@ -5,8 +5,8 @@ **/ :root { --primary: #16253F; - --primary-contrast: #1a1a1a; - --primary-hover: #CC660099; + --primary-contrast: #ffffff; + --primary-hover: #16253F99; --secondary: #182517; --secondary-contrast: #FAFBFC; --secondary-hover: #E8EBEF;