praiadeseselle/site/templates/xes-acceder.php
2022-10-23 22:35:04 +02:00

111 lines
No EOL
5.3 KiB
PHP

<?php namespace ProcessWire;
define("RECAPTCHA_V3_SECRET_KEY", '6LexXqYiAAAAAOoFqs4kfWd7zW6stVRK0aViyiQo');
if($input->post->usuario && $input->post->contrasinal)
{
$user = $sanitizer->username($input->post->usuario);
$pass = $input->post->contrasinal;
}
$token = $input->post->token;
$action = $input->post->action;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('secret' => RECAPTCHA_V3_SECRET_KEY, 'response' => $token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$arrResponse = json_decode($response, true);
if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.5)
{
if($session->login($user, $pass))
{
$session->redirect($page->parent->httpUrl);
}
else
{
$mensaxe_tipo = "erro";
$mensaxe = _x('Wrong username or password', 'Wrong username or password');
}
}
else
{
$mensaxe_tipo = "alerta";
$mensaxe = _x('Wrong reCaptcha', 'Wrong reCaptcha');
}
?><!DOCTYPE html>
<html lang="<?php echo _x('en', 'HTML language code'); ?>">
<head>
<title><?php echo $titulo; ?></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo $config->urls->templates; ?>images/favicon-32x32.png">
<link rel="shortcut icon" href="<?php echo $config->urls->templates; ?>images/favicon.ico">
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>css/reset.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>css/fonts.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>css/swiper.css" />
<link title="Praia de Seselle" rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>css/style.css" />
<style>
:root
{
font-size: 16px;
--cor_60: <?php echo $configuracion['cor_fondo'] ?>;
--cor_30: <?php echo $configuracion['cor_principal'] ?>;
--cor_10: <?php echo $configuracion['cor_secundario'] ?>;
}
</style>
</head>
<body>
<a href="#contido" class="visually-hidden element-focusable bypass-to-main"><?php echo _x('Skip to content', 'bypass'); ?></a>
<header id="cabeceira">
<div class="contedor">
<div id="logo">
<picture>
<source srcset="<?php echo $config->urls->templates?>images/logo-praia-seselle-150x116.jpg" media="(max-width: 767px)">
<source srcset="<?php echo $config->urls->templates?>images/logo-praia-seselle-230x179.jpg" media="(min-width: 768px)">
<img src="<?php echo $config->urls->templates?>images/logo-praia-seselle.svg" alt="<?php echo _x('Logo of Praia de Seselle Tourist Apartments', 'Site logo'); ?>">
</picture>
<h1 class="visually-hidden"><?php echo $configuracion['sitio_nome']; ?> <?php echo $configuracion['sitio_descripcion']; ?></h1>
</div>
</div>
</header>
<main id="contido">
<div class="contedor">
<form id="inicio-sesion" onSubmit="getToken(event)" action="/es/gestion/acceder/" method='post'>
<h2><?php echo _x('Log in', 'Log in'); ?></h2>
<?php if($input->post->usuario): ?>
<div id="notificacions" class="<?php echo $mensaxe_tipo; ?>">
<h3><i class="icon-x-circle"></i> <?php echo $mensaxe ?></h2>
</div>
<?php endif; ?>
<div class="elemento">
<label for="usuario"><?php echo _x('Username', 'Username') ?>:</label>
<input type="text" id="usuario" name="usuario">
</div>
<div class="elemento">
<label for="contrasinal"><?php echo _x('Password', 'Password') ?>:</label>
<input type="password" id="contrasinal" name="contrasinal">
</div>
<input type="submit" id="enviar" name="enviar" value="<?php echo _x('Log in', 'Log in'); ?>">
</form>
</div>
</main>
<footer id="pe">
<h2 class="visually-hidden"><?php echo _x('Footer', 'Page footer');?></h2>
<div class="contedor">
<p>&copy;2022 <?php echo $configuracion['sitio_nome']
. ' ' . $configuracion['sitio_descripcion']; ?>.</p>
<p><?php echo _x('All rights reserved', 'copyright');?></p>
<p><?php echo _x('Designed and Developed by', 'developer');?> <a target="_blank" href="https://artabro.org">Codigo Artabro</a></p>
</div>
</footer>
<script src="https://www.google.com/recaptcha/api.js?render=6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8"></script>
<script src="<?php echo $config->urls->templates?>js/main.js"></script>
</body>
</html>