Skip to content

Instantly share code, notes, and snippets.

@IsaiChristian
Last active April 5, 2018 14:55
Show Gist options
  • Save IsaiChristian/7daa38a422b698f49b8441e8b9ae539b to your computer and use it in GitHub Desktop.
Save IsaiChristian/7daa38a422b698f49b8441e8b9ae539b to your computer and use it in GitHub Desktop.
Agregar Captcha Formulario #Captcha #ps
/*Dale un espacio*/
.g-recaptcha {
margin-bottom: 30px;
display: flex;
justify-content: center;
}
/*Que se vea bien en mobil*/
@media screen and (max-height: 575px){
#rc-imageselect,
.g-recaptcha {
transform:scale(0.77);
-webkit-transform:scale(0.77);
transform-origin:0 0;-webkit-transform-origin:0 0;}
}
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="6LcLQVEUAAAAANMCQeYiiWW8VYFb2h3zcE0ONOfN"></div>
if (Tools::isSubmit('submitMessage')) {
$extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg');
$file_attachment = Tools::fileAttachment('fileUpload');
$message = Tools::getValue('message'); // Html entities is not usefull, iscleanHtml check there is no bad html tags.
$id_order = (int)$this->getOrder();
if (!($from = trim(Tools::getValue('from'))) || !Validate::isEmail($from)) {
$this->errors[] = Tools::displayError('Invalid email address.');
// add the 2 lines from here
} elseif (!($gcaptcha = (int)(Tools::getValue('g-recaptcha-response')))) {
$this->errors[] = Tools::displayError('Captcha error');
// to here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment