Mejoras a administracion
This commit is contained in:
@ -90,9 +90,12 @@ return [
|
|||||||
'app.cookie.name' => 'login',
|
'app.cookie.name' => 'login',
|
||||||
'app.cookie.time' => 20 * 60 * 60, // 20 min
|
'app.cookie.time' => 20 * 60 * 60, // 20 min
|
||||||
'files.login' => 'login.yml',
|
'files.login' => 'login.yml',
|
||||||
'urls.login' => DI\string(implode('/', [
|
'urls.admin' => DI\string(implode('/', [
|
||||||
'{urls.base}',
|
'{urls.base}',
|
||||||
'admin',
|
'admin'
|
||||||
|
])),
|
||||||
|
'urls.login' => DI\string(implode('/', [
|
||||||
|
'{urls.admin}',
|
||||||
'login'
|
'login'
|
||||||
]))
|
]))
|
||||||
];
|
];
|
||||||
|
@ -43,6 +43,7 @@ return [
|
|||||||
return new ProVM\NotariaRaby\Common\Service\Login(
|
return new ProVM\NotariaRaby\Common\Service\Login(
|
||||||
$c->get('app.cookie.name'),
|
$c->get('app.cookie.name'),
|
||||||
$c->get('app.cookie.time'),
|
$c->get('app.cookie.time'),
|
||||||
|
$c->get('urls.admin'),
|
||||||
getenv('ADMIN_PASSWORD'),
|
getenv('ADMIN_PASSWORD'),
|
||||||
$c->get('files.login'),
|
$c->get('files.login'),
|
||||||
$c->get(ProVM\Common\Service\Filemanager::class)
|
$c->get(ProVM\Common\Service\Filemanager::class)
|
||||||
|
@ -11,8 +11,9 @@ class Login {
|
|||||||
protected $password;
|
protected $password;
|
||||||
protected $filename;
|
protected $filename;
|
||||||
protected $manager;
|
protected $manager;
|
||||||
public function __construct(string $cookie_name, int $time_limit, string $encrypted_password, string $login_file, Filemanager $filemanager) {
|
public function __construct(string $cookie_name, int $time_limit, string $base_url, string $encrypted_password, string $login_file, Filemanager $filemanager) {
|
||||||
$this->cookie_name = $cookie_name;
|
$this->cookie_name = $cookie_name;
|
||||||
|
$this->base_url = $base_url;
|
||||||
$this->time_limit = $time_limit;
|
$this->time_limit = $time_limit;
|
||||||
$this->password = $encrypted_password;
|
$this->password = $encrypted_password;
|
||||||
$this->filename = $login_file;
|
$this->filename = $login_file;
|
||||||
@ -31,7 +32,7 @@ class Login {
|
|||||||
public function saveCookie() {
|
public function saveCookie() {
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
$exp = $now->addSeconds($this->time_limit);
|
$exp = $now->addSeconds($this->time_limit);
|
||||||
\setcookie($this->cookie_name, implode(':', [$this->selector, $this->token]), $exp->timestamp, '/');
|
\setcookie($this->cookie_name, implode(':', [$this->selector, $this->token]), $exp->timestamp, $this->base_url);
|
||||||
}
|
}
|
||||||
public function removeCookie() {
|
public function removeCookie() {
|
||||||
\setcookie($this->cookie_name, '', Carbon::now()->timestamp, '/');
|
\setcookie($this->cookie_name, '', Carbon::now()->timestamp, '/');
|
||||||
|
@ -70,7 +70,7 @@ class Filemanager {
|
|||||||
}
|
}
|
||||||
return $temp;
|
return $temp;
|
||||||
}
|
}
|
||||||
public function save(string $filename, $data) {
|
public function save(string $filename, $data): bool {
|
||||||
if (is_object($data)) {
|
if (is_object($data)) {
|
||||||
$data = (array) $data;
|
$data = (array) $data;
|
||||||
}
|
}
|
||||||
@ -78,6 +78,6 @@ class Filemanager {
|
|||||||
$data = Yaml::YAMLDump($data, false, false, true);
|
$data = Yaml::YAMLDump($data, false, false, true);
|
||||||
}
|
}
|
||||||
$filename = $this->fullPath($filename);
|
$filename = $this->fullPath($filename);
|
||||||
file_put_contents($filename, $data);
|
return file_put_contents($filename, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ip: localhost
|
ip: localhost
|
||||||
token: >
|
token: >
|
||||||
2c579161cd33d9b2d3dd7791:b6936fbd9f2f1403558af3e5bc5330188af9a03e
|
4b2910b375e3ae3ff415b8ad:80dbbc8862d0bf7d45155a982a6721d768596a0a
|
||||||
time: 2020-04-07 16:20
|
time: 2020-04-10 16:17
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@extends('admin.layout.base')
|
@extends('admin.layout.base')
|
||||||
|
|
||||||
@section('content')
|
@section('page_content')
|
||||||
<div id="admin">
|
<div id="admin">
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<div class="ui stackable two columns grid">
|
<div class="ui stackable two columns grid">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@extends('admin.layout.base')
|
@extends('admin.layout.base')
|
||||||
|
|
||||||
@section('content')
|
@section('page_content')
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<h2>Cambiar Clave</h2>
|
<h2>Cambiar Clave</h2>
|
||||||
<form class="ui form" method="post" action="{{$urls->base}}/admin/clave" id="clave_form">
|
<form class="ui form" method="post" action="{{$urls->base}}/admin/clave" id="clave_form">
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
@extends('layout.base')
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
@include('layout.head')
|
||||||
|
@include('admin.layout.body')
|
||||||
|
</html>
|
||||||
|
|
||||||
@section('page_title')
|
@section('page_title')
|
||||||
- Admin
|
- Admin
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('page_content')
|
|
||||||
<div class="ui fluid container">
|
|
||||||
<br />
|
|
||||||
@yield('content')
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
|
10
resources/views/admin/layout/body.blade.php
Normal file
10
resources/views/admin/layout/body.blade.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<body>
|
||||||
|
<div id="page_container" class="ui fluid container">
|
||||||
|
@include('admin.layout.header')
|
||||||
|
<div class="content">
|
||||||
|
<br />
|
||||||
|
@yield('page_content')
|
||||||
|
</div>
|
||||||
|
@include('layout.footer')
|
||||||
|
</div>
|
||||||
|
</body>
|
5
resources/views/admin/layout/header.blade.php
Normal file
5
resources/views/admin/layout/header.blade.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<header class="ui dark-blue inverted">
|
||||||
|
<div class="ui container">
|
||||||
|
@include('admin.layout.menu')
|
||||||
|
</div>
|
||||||
|
</header>
|
@ -1,8 +1,7 @@
|
|||||||
<div class="ui container">
|
<nav class="ui inverted attached massive text stackable menu" id="page_menu">
|
||||||
<nav class="ui secondary pointing menu">
|
<a class="left aligned item brand" href="{{$urls->base}}">
|
||||||
<a class="item" href="{{$urls->base}}">Inicio</a>
|
NOTARÍA PATRICIO RABY BENAVENTE
|
||||||
<a class="active item" href="{{$urls->base}}/admin">Administración</a>
|
</a>
|
||||||
<a class="item" href="{{$urls->base}}/admin/notificacion">Notificación</a>
|
<a class="item" href="{{$urls->base}}/admin">Inicio Administración</a>
|
||||||
|
<a class="item" href="{{$urls->base}}/admin/clave">Configuración</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
|
||||||
<br />
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@extends('admin.layout.base')
|
@extends('admin.layout.base')
|
||||||
|
|
||||||
@section('content')
|
@section('page_content')
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<form class="ui form" method="post" action="{{$urls->base}}/admin/login">
|
<form class="ui form" method="post" action="{{$urls->base}}/admin/login">
|
||||||
<div class="ui center aligned grid">
|
<div class="ui center aligned grid">
|
||||||
|
Reference in New Issue
Block a user