2022-10-06 13:14:42 +02:00
|
|
|
<?php namespace ProcessWire;
|
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
define("RECAPTCHA_V3_SECRET_KEY", '6LexXqYiAAAAAOoFqs4kfWd7zW6stVRK0aViyiQo');
|
2022-10-06 13:14:42 +02:00
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
if($input->post->usuario && $input->post->contrasinal)
|
|
|
|
{
|
|
|
|
$user = $sanitizer->username($input->post->usuario);
|
|
|
|
$pass = $input->post->contrasinal;
|
2022-10-06 13:14:42 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
$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);
|
2022-10-06 13:14:42 +02:00
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.5)
|
2022-10-06 13:14:42 +02:00
|
|
|
{
|
2022-10-23 22:35:04 +02:00
|
|
|
if($session->login($user, $pass))
|
2022-10-06 13:14:42 +02:00
|
|
|
{
|
2022-10-23 22:35:04 +02:00
|
|
|
$session->redirect($page->parent->httpUrl);
|
2022-10-06 13:14:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-23 22:35:04 +02:00
|
|
|
$mensaxe_tipo = "erro";
|
|
|
|
$mensaxe = _x('Wrong username or password', 'Wrong username or password');
|
2022-10-06 13:14:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-10-23 22:35:04 +02:00
|
|
|
$mensaxe_tipo = "alerta";
|
|
|
|
$mensaxe = _x('Wrong reCaptcha', 'Wrong reCaptcha');
|
2022-10-06 13:14:42 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
?><!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">
|
2023-03-22 17:48:48 +01:00
|
|
|
<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; ?>vendors/Bootstrap/css/bootstrap.css">
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates; ?>vendors/Swiperjs/css/swiper-bundle.min.css">
|
|
|
|
<link title="Praia de Seselle" rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>css/style.css">
|
2022-10-23 22:35:04 +02:00
|
|
|
<style>
|
|
|
|
:root
|
|
|
|
{
|
|
|
|
font-size: 16px;
|
2022-10-06 13:14:42 +02:00
|
|
|
|
2022-10-23 22:35:04 +02:00
|
|
|
--cor_60: <?php echo $configuracion['cor_fondo'] ?>;
|
|
|
|
--cor_30: <?php echo $configuracion['cor_principal'] ?>;
|
|
|
|
--cor_10: <?php echo $configuracion['cor_secundario'] ?>;
|
2023-03-22 17:48:48 +01:00
|
|
|
--imaxe_destacada: <?php echo $page->imaxe ? 'url("'. $page->imaxe->url . '")' : 'none'; ?>;
|
2022-10-23 22:35:04 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
2023-03-22 17:48:48 +01:00
|
|
|
<body class="signin text-center">
|
|
|
|
<main class="form-signin w-100 m-auto">
|
|
|
|
<form id="inicio-sesion" onSubmit="getLogin(event)" action="/es/gestion/acceder/" method='post'>
|
|
|
|
<picture class="mb-4">
|
|
|
|
<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>
|
|
|
|
<h2 class="h3 mb-3 fw-normal"><?php echo _x('Log in', 'Log in'); ?></h2>
|
|
|
|
<div class="form-floating">
|
|
|
|
<input type="text" class="form-control" id="usuario" placeholder="<?php echo _x('Username', 'Username') ?>">
|
|
|
|
<label for="usuario"><?php echo _x('Username', 'Username') ?>:</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-floating">
|
|
|
|
<input type="password" class="form-control" id="contrasinal" placeholder="<?php echo _x('Password', 'Password') ?>">
|
|
|
|
<label for="contrasinal"><?php echo _x('Password', 'Password') ?>:</label>
|
2022-10-06 13:14:42 +02:00
|
|
|
</div>
|
2022-10-23 22:35:04 +02:00
|
|
|
<?php if($input->post->usuario): ?>
|
2023-03-22 17:48:48 +01:00
|
|
|
<div id="notificacions" class="<?php echo $mensaxe_tipo; ?>">
|
|
|
|
<h3><i class="icon-x-circle"></i> <?php echo $mensaxe ?></h2>
|
|
|
|
</div>
|
2022-10-23 22:35:04 +02:00
|
|
|
<?php endif; ?>
|
2023-03-22 17:48:48 +01:00
|
|
|
<div class="checkbox mb-3">
|
|
|
|
<label>
|
|
|
|
<input type="checkbox" value="remember-me"> Remember me
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<input class="w-100 btn btn-lg btn-primary" type="submit" id="enviar" name="enviar" value="<?php echo _x('Log in', 'Log in'); ?>">
|
2022-10-23 22:35:04 +02:00
|
|
|
<p>©2022 <?php echo $configuracion['sitio_nome']
|
|
|
|
. ' ' . $configuracion['sitio_descripcion']; ?>.</p>
|
2023-03-22 17:48:48 +01:00
|
|
|
</form>
|
|
|
|
</main>
|
2022-10-23 22:35:04 +02:00
|
|
|
<script src="https://www.google.com/recaptcha/api.js?render=6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8"></script>
|
2023-03-22 17:48:48 +01:00
|
|
|
<script src="<?php echo $config->urls->templates?>vendors/Swiperjs/js/swiper-bundle.min.js"></script>
|
2022-10-23 22:35:04 +02:00
|
|
|
<script src="<?php echo $config->urls->templates?>js/main.js"></script>
|
|
|
|
</body>
|
2022-10-06 13:14:42 +02:00
|
|
|
</html>
|