diff --git a/site/templates/contacto.php b/site/templates/contacto.php index 0ffb2c6..e9bf2d8 100644 --- a/site/templates/contacto.php +++ b/site/templates/contacto.php @@ -2,6 +2,7 @@ /** @var Page $page API variable */ +define("RECAPTCHA_V3_SECRET_KEY", '6LexXqYiAAAAAOoFqs4kfWd7zW6stVRK0aViyiQo'); $menu = ''; $contido = ''; @@ -22,8 +23,31 @@ if(isset($_POST['enviar'])) $correo->fromName($sanitizer->text($input->post->nome)); $correo->subject($sanitizer->text($input->post->asunto)); $correo->body($sanitizer->text($input->post->mensaxe)); - $correo->send(); - $enviado = $correo->getResult(); + + $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) + { + $correo->send(); + $enviado = $correo->getResult(); + } + else + { + $mensaxe_tipo = "alerta"; + $mensaxe = _x('Wrong reCaptcha', 'Wrong reCaptcha'); + } + + } $contido .= renderMigasPan($page) . "\n"; @@ -33,7 +57,7 @@ $contido .= '

' . ucfirst($page->title) . '

' . " $contido .= '
' . "\n"; $contido .= '
' . "\n"; $contido .= '
' . "\n"; -$contido .= '
' . "\n"; +$contido .= '' . "\n"; $contido .= '
' . "\n"; $contido .= '
' . "\n"; $contido .= '' . "\n"; diff --git a/site/templates/css/style.css b/site/templates/css/style.css index af7f7ee..abd5b61 100644 --- a/site/templates/css/style.css +++ b/site/templates/css/style.css @@ -10,6 +10,15 @@ body font-size: 1rem; } +body.signin +{ + display: flex; + align-items: center; + padding-top: 40px; + padding-bottom: 40px; + background-color: #f5f5f5; +} + a { color: rgba(var(--cor_30), var(--bs-link-opacity, 1)); @@ -274,18 +283,18 @@ time span padding-right: unset; } -.form-floating > .form-control, -.form-floating > .form-control-plaintext, -.form-floating > .form-select +#search .form-floating > .form-control, +#search .form-floating > .form-control-plaintext, +#search .form-floating > .form-select { height: calc(2.25rem + 2px); line-height: 1.25; } -.form-floating > .form-control:focus ~ label, -.form-floating > .form-control:not(:placeholder-shown) ~ label, -.form-floating > .form-control-plaintext ~ label, -.form-floating > .form-select ~ label +#search .form-floating > .form-control:focus ~ label, +#search .form-floating > .form-control:not(:placeholder-shown) ~ label, +#search .form-floating > .form-control-plaintext ~ label, +#search .form-floating > .form-select ~ label { height: unset; width: unset; @@ -410,6 +419,31 @@ a.collapse-head.active:before border-color: rgba(var(--cor_30), var(--bs-border-opacity)) !important; } +.form-signin +{ + max-width: 330px; + padding: 15px; +} + +.form-signin .form-floating:focus-within +{ + z-index: 2; +} + +.form-signin input[type="text"] +{ + margin-bottom: -1px; + border-bottom-right-radius: 0; + border-bottom-left-radius: 0; +} + +.form-signin input[type="password"] +{ + margin-bottom: 10px; + border-top-left-radius: 0; + border-top-right-radius: 0; +} + @media (min-width: 992px) { #menu-desplegable .nav-item, diff --git a/site/templates/js/main.js b/site/templates/js/main.js index e7039b0..81931cd 100644 --- a/site/templates/js/main.js +++ b/site/templates/js/main.js @@ -22,7 +22,6 @@ document.addEventListener("hide.bs.collapse", function (e) e.target.previousElementSibling.classList.remove("active"); }); - const swiper_galeria = new Swiper("#galeria", { slidesPerView: 1, @@ -50,3 +49,58 @@ const swiper_galeria = new Swiper("#galeria", }, }); +function getLogin(event) +{ + event.preventDefault(); + grecaptcha.ready(function() + { + grecaptcha.execute('6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8', { action: 'submit' }).then(function(token) + { + var form = document.getElementById("inicio-sesion"); + var boton_token = document.createElement('input'); + + boton_token.type = 'hidden'; + boton_token.name = 'token'; + boton_token.id = 'token'; + boton_token.value = token; + + var boton_action = document.createElement('input'); + boton_action.type = 'hidden'; + boton_action.name = 'action'; + boton_action.id = 'action'; + boton_action.value = 'submit'; + + form.appendChild(boton_token); + form.appendChild(boton_action); + form.submit(); + });; + }); +} + +function getContact(event) +{ + event.preventDefault(); + grecaptcha.ready(function() + { + grecaptcha.execute('6LexXqYiAAAAACwDpMGIg1OMnAXVJU0VmbEMQUD8', { action: 'submit' }).then(function(token) + { + var form = document.getElementById("formulario-contacto"); + var boton_token = document.createElement('input'); + + boton_token.type = 'hidden'; + boton_token.name = 'token'; + boton_token.id = 'token'; + boton_token.value = token; + + var boton_action = document.createElement('input'); + boton_action.type = 'hidden'; + boton_action.name = 'action'; + boton_action.id = 'action'; + boton_action.value = 'submit'; + + form.appendChild(boton_token); + form.appendChild(boton_action); + form.submit(); + });; + }); +} \ No newline at end of file diff --git a/site/templates/layout/partial/main_foot.php b/site/templates/layout/partial/main_foot.php index 22f18c2..11b396d 100644 --- a/site/templates/layout/partial/main_foot.php +++ b/site/templates/layout/partial/main_foot.php @@ -27,6 +27,8 @@
+ + \ No newline at end of file diff --git a/site/templates/layout/partial/main_head.php b/site/templates/layout/partial/main_head.php index 2f7a036..be36c53 100644 --- a/site/templates/layout/partial/main_head.php +++ b/site/templates/layout/partial/main_head.php @@ -97,7 +97,7 @@ if($input->get->logout == true)

- +
…" /> diff --git a/site/templates/xes-acceder.php b/site/templates/xes-acceder.php index 6411805..8031082 100644 --- a/site/templates/xes-acceder.php +++ b/site/templates/xes-acceder.php @@ -46,10 +46,11 @@ else - - - - + + + + + - - -
-
- -
-
-
- -

post->usuario): ?> -
-

-
+
+

+
-
- - -
-
- - -
- - -
-
- + + + \ No newline at end of file