praiadeseselle/site/templates/acceder.php

67 lines
2.4 KiB
PHP
Raw Permalink Normal View History

<?php namespace ProcessWire;
/** @var Page $page */
/** @var Pages $pages */
/** @var Config $config */
/** @var Sanitizer $sanitizer API variable */
/** @var WireInput $input API variable */
/** @var User $user API variable */
/** @var Languages $languages API variable */
/** @var SiteConfig $configuracion */
/** @var HomePage $inicio */
if($input->get->logout == true)
{
$session->logout();
$session->redirect('/');
}
$menu = '';
$saida = '';
$usuario = '';
$contrasinal = '';
$mensaxe_tipo = '';
$mensaxe = '';
$captcha = $modules->get('MarkupGoogleRecaptcha');
if ($captcha->verifyResponse() === true)
{
$usuario = $sanitizer->username($input->post->usuario);
$contrasinal = $input->post->contrasinal;
if($session->login($usuario, $contrasinal))
{
$session->redirect($inicio->url);
}
else
{
$mensaxe_tipo = "x-circle";
$mensaxe = _x('Wrong username or password', 'Wrong username or password');
}
}
?>
<main id="contido" class="completo">
<article id="<?=$page->name;?>">
<h1 class="visually-hidden"><?=ucfirst($page->title);?></h1>
<section id="accceso-formulario">
<h2><?=_x('Employee Access', 'employee access');?></h2>
<form method="post" action="<?=$page->url;?>">
<label for="usuario"><?=_x('Username', 'Username');?>:</label>
<input type="text" id="usuario">
<label for="contrasinal"><?=_x('Password', 'Password');?>:</label>
<input type="password" id="contrasinal">
<?php if($mensaxe != ''): ?>
<div id="notificacions" class="alerta <?=$mensaxe_tipo;?>" role="alert">
<span class="icono-<?=$mensaxe_tipo;?>"></span>
<p><?=$mensaxe;?></p>
<span class="icono-x pechar" onclick="this.parentElement.style.display='none';"></span>
</div>
<?php endif; ?>
<?=$captcha->render();?>
<input type="submit" id="enviar" name="enviar" class="boton activo" value="<?=_x('Log in', 'Log in');?>">
<a href="/" class="boton activo centrado"><?=_x('Return', 'return');?></a>
<?=$captcha->getScript();?>
</form>
</section>
</article">
</main>