Authentificacion
This commit is contained in:
@ -18,6 +18,12 @@ class Login {
|
||||
$container->get('urls.base'),
|
||||
'admin'
|
||||
]))
|
||||
->withStatus(301);
|
||||
->withStatus(302);
|
||||
}
|
||||
public function logout(Request $request, Response $response, Service $login, Container $container): Response {
|
||||
$login->logout();
|
||||
return $response
|
||||
->withHeader('Location', $container->get('urls.base'))
|
||||
->withStatus(302);
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class Auth {
|
||||
$response = $handler->handle($request);
|
||||
|
||||
$is_logged_in = $this->login->checkAuth($request);
|
||||
if (!$is_logged_in and $request->getRequestTarget() != $this->login_url) {
|
||||
if (!$is_logged_in and $request->getRequestTarget() != $this->login_url and $request->getRequestTarget() != implode('/', [dirname($this->login_url), 'logout'])) {
|
||||
return $response
|
||||
->withHeader('Location', $this->login_url)
|
||||
->withStatus(301);
|
||||
|
@ -108,4 +108,15 @@ class Login {
|
||||
$this->is_logged_in = true;
|
||||
return true;
|
||||
}
|
||||
public function logout(): bool {
|
||||
$this->removeCookie();
|
||||
$data = [
|
||||
'ip' => 0,
|
||||
'token' => ':',
|
||||
'time' => 0
|
||||
];
|
||||
$this->manager->folder('data')->save($this->filename, $data);
|
||||
$this->is_logged_in = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,9 @@
|
||||
background-blend-mode: multiply;
|
||||
color: white;
|
||||
}
|
||||
#banner a {
|
||||
color: inherit;
|
||||
}
|
||||
#banner .segment {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
ip: localhost
|
||||
token: >
|
||||
4b2910b375e3ae3ff415b8ad:80dbbc8862d0bf7d45155a982a6721d768596a0a
|
||||
time: 2020-04-10 16:17
|
||||
ip: 0
|
||||
token: ':'
|
||||
time: 0
|
||||
|
@ -5,3 +5,4 @@ $app->group('/login', function($app) {
|
||||
$app->get('[/]', Login::class);
|
||||
$app->post('[/]', [Login::class, 'do_login']);
|
||||
});
|
||||
$app->get('/logout', [Login::class, 'logout']);
|
||||
|
@ -3,11 +3,24 @@
|
||||
</h4>
|
||||
<div class="ui list">
|
||||
@include('admin.documento', ['descripcion' => 'Índices', 'link' => 'indices', 'mod' => 'fecha'])
|
||||
</div>
|
||||
<h4>
|
||||
Transparencia
|
||||
</h4>
|
||||
<div class="ui list">
|
||||
@include('admin.documento', ['descripcion' => 'Balances Anuales', 'link' => 'balances_anuales'])
|
||||
@include('admin.documento', ['descripcion' => 'Interés y Patrimonio', 'link' => 'intereses_y_patrimonio'])
|
||||
@include('admin.documento', ['descripcion' => 'Informes Fiscalía', 'link' => 'informes_fiscalia'])
|
||||
@include('admin.documento', ['descripcion' => 'Valores', 'link' => 'valores'])
|
||||
</div>
|
||||
<div class="ui toggle checkbox" id="transparencia">
|
||||
<label>Activar</label>
|
||||
<input type="checkbox" name="transparencia"
|
||||
@if ($transparencia)
|
||||
checked="checked"
|
||||
@endif
|
||||
/>
|
||||
</div>
|
||||
<div class="ui basic modal" id="doc_form">
|
||||
<i class="close icon"></i>
|
||||
<div class="inverted dark-blue header">
|
||||
@ -23,17 +36,6 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<h4>
|
||||
Transparencia
|
||||
</h4>
|
||||
<div class="ui toggle checkbox" id="transparencia">
|
||||
<label>Activar</label>
|
||||
<input type="checkbox" name="transparencia"
|
||||
@if ($transparencia)
|
||||
checked="checked"
|
||||
@endif
|
||||
/>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<nav class="ui inverted attached massive text stackable menu" id="page_menu">
|
||||
<a class="left aligned item brand" href="{{$urls->base}}">
|
||||
<a class="left aligned item brand" href="{{$urls->base}}/admin">
|
||||
NOTARÍA PATRICIO RABY BENAVENTE
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}/admin">Inicio Administración</a>
|
||||
<a class="item" href="{{$urls->base}}/admin/clave">Configuración</a>
|
||||
<a class="item" href="{{$urls->base}}/admin/clave">Cambiar Clave</a>
|
||||
<a class="item" href="{{$urls->base}}/admin/logout">Salir</a>
|
||||
</nav>
|
||||
|
@ -3,10 +3,10 @@
|
||||
<a class="item" href="{{$urls->base}}">
|
||||
Notaría
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#servicios">
|
||||
<a class="item" href="#servicios">
|
||||
Servicios
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}#consultas">
|
||||
<a class="item" href="#consultas">
|
||||
Consultas
|
||||
</a>
|
||||
<a class="item" href="{{$urls->base}}/contacto">
|
||||
|
Reference in New Issue
Block a user