praiadeseselle/site/templates/xes-acceder.php

103 lines
No EOL
5.2 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; ?>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">
<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'] ?>;
--imaxe_destacada: <?php echo $page->imaxe ? 'url("'. $page->imaxe->url . '")' : 'none'; ?>;
}
</style>
</head>
<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>
</div>
<?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="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'); ?>">
<p>&copy;2022 <?php echo $configuracion['sitio_nome']
. ' ' . $configuracion['sitio_descripcion']; ?>.</p>
</form>
</main>
<script src="https://www.google.com/recaptcha/api.js?render=6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8"></script>
<script src="<?php echo $config->urls->templates?>vendors/Swiperjs/js/swiper-bundle.min.js"></script>
<script src="<?php echo $config->urls->templates?>js/main.js"></script>
</body>
</html>