jekyll-theme-consulting 0.10.2 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/_includes/contact_client_script.html +9 -18
- data/_layouts/contact.html +27 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 347a757205a09656983285677789e0cbec55f65554c35d599e377a791df5f038
|
4
|
+
data.tar.gz: 88e7ac638a75e585d5fd40bcf98b01317eddaac19468745bba87d7d8dbcf5b59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b05b7ef191bba9782cc431bab31e2ea187da12dea2103c558c04278379436ecef3fe88c8e44628cc976ba036357dfeb2eda241a5d379154082a9c2321791e5
|
7
|
+
data.tar.gz: b6f5f055e3d20ca026a0d1008670344474c2b989fb1b5b6731248aed0d291347f43d17d552664077b144443fb82b5db6ec162924b8625dfac7dc262a552786b9
|
@@ -54,25 +54,17 @@
|
|
54
54
|
};
|
55
55
|
|
56
56
|
const sendContactMessage = function() {
|
57
|
-
const
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
};
|
57
|
+
const formData = new FormData();
|
58
|
+
formData.append('name', encodeURI(nameInputElement.value));
|
59
|
+
formData.append('email', encodeURI(emailInputElement.value));
|
60
|
+
formData.append('message', encodeURI(messageInputElement.value));
|
61
|
+
formData.append('token', grecaptcha.getResponse(recaptchaWidget));
|
63
62
|
|
64
63
|
fetch("{{ '/contact.php' | absolute_url }}", {
|
65
64
|
method: 'POST',
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
})
|
70
|
-
.then((response) => {
|
71
|
-
alert('Message sent!');
|
72
|
-
})
|
73
|
-
.catch((error) => {
|
74
|
-
console.error('Error:', error);
|
75
|
-
});
|
65
|
+
body: formData})
|
66
|
+
.then((response) => alert('Message sent!'))
|
67
|
+
.catch((error) => console.error('Error:', error));
|
76
68
|
};
|
77
69
|
|
78
70
|
var onRecaptchaLoadCallback = function() {
|
@@ -80,8 +72,7 @@
|
|
80
72
|
'sitekey' : '{{ site.recaptcha.sitekey }}',
|
81
73
|
'theme' : 'dark',
|
82
74
|
'size' : 'compact',
|
83
|
-
'callback' : processContactRequest
|
84
|
-
});
|
75
|
+
'callback' : processContactRequest});
|
85
76
|
};
|
86
77
|
|
87
78
|
modalWindowElement.addEventListener('click', hideModalWindow);
|
data/_layouts/contact.html
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
---
|
2
2
|
permalink: /contact.php
|
3
|
-
|
3
|
+
mail:
|
4
|
+
subject:
|
5
|
+
intro:
|
4
6
|
---
|
7
|
+
{%- capture mail-intro -%}You received a message on <a href='{{ site.url }}'>your website</a>.{%- endcapture -%}
|
5
8
|
<?php
|
6
9
|
|
7
|
-
$
|
10
|
+
$contact_name = $contact_email = $contact_message = $token = $contact_ip = "";
|
8
11
|
|
9
12
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
10
13
|
if (has_required_data($_POST)) {
|
11
|
-
$
|
14
|
+
$contact_name = filter_var(
|
12
15
|
$_POST["name"],
|
13
16
|
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
14
|
-
$
|
17
|
+
$contact_email = filter_var(
|
15
18
|
$_POST["email"],
|
16
19
|
FILTER_SANITIZE_EMAIL);
|
17
|
-
$
|
20
|
+
$contact_message = filter_var(
|
18
21
|
$_POST["message"],
|
19
22
|
FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
20
23
|
$token = filter_var(
|
@@ -23,13 +26,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
23
26
|
if (filter_var(
|
24
27
|
$_SERVER['REMOTE_ADDR'],
|
25
28
|
FILTER_VALIDATE_IP)) {
|
26
|
-
$
|
29
|
+
$contact_ip = $_SERVER['REMOTE_ADDR'];
|
27
30
|
}
|
28
31
|
|
29
|
-
if is_recaptcha_valid($token) {
|
30
|
-
send_mail($
|
32
|
+
if (is_recaptcha_valid($token)) {
|
33
|
+
send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
|
31
34
|
} else {
|
32
|
-
send_mail($
|
35
|
+
send_mail($contact_name, $contact_email, "Tried to contact you, but his recaptcha is not valid.", $contact_ip);
|
33
36
|
}
|
34
37
|
}
|
35
38
|
}
|
@@ -45,8 +48,7 @@ function has_required_data($request) {
|
|
45
48
|
!empty($request['name'])
|
46
49
|
&& !empty($request['email'])
|
47
50
|
&& !empty($request['message'])
|
48
|
-
&& !empty($request['token']))
|
49
|
-
);
|
51
|
+
&& !empty($request['token'])));
|
50
52
|
}
|
51
53
|
|
52
54
|
function is_recaptcha_valid($token) {
|
@@ -56,9 +58,7 @@ function is_recaptcha_valid($token) {
|
|
56
58
|
'http' => array(
|
57
59
|
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
58
60
|
'method' => 'POST',
|
59
|
-
'content' => http_build_query($data)
|
60
|
-
)
|
61
|
-
);
|
61
|
+
'content' => http_build_query($data)));
|
62
62
|
$context = stream_context_create($options);
|
63
63
|
$result = json_decode(file_get_contents($validation_url, false, $context));
|
64
64
|
|
@@ -68,12 +68,21 @@ function is_recaptcha_valid($token) {
|
|
68
68
|
&& $result->success);
|
69
69
|
}
|
70
70
|
|
71
|
-
function send_mail ($name, $email, $message) {
|
71
|
+
function send_mail ($name, $email, $message, $ip) {
|
72
72
|
return mail(
|
73
73
|
"{{ site.email }}",
|
74
|
-
"{{ page.subject | default: 'Contact request' }}",
|
75
|
-
|
76
|
-
|
74
|
+
"{{ page.mail.subject | default: 'Contact request' }}",
|
75
|
+
(
|
76
|
+
"{{ page.mail.intro | default: mail-intro }}<br>\r\n"
|
77
|
+
."Ip: ".$ip."<br>\r\n"
|
78
|
+
."Name: ".$name."<br>\r\n"
|
79
|
+
."Email: ".$email."<br>\r\n"
|
80
|
+
."Message: ".$message."<br>\r\n"),
|
81
|
+
(
|
82
|
+
"From: ".$name
|
83
|
+
." <".$email.">\r\n"
|
84
|
+
."MIME-Version: 1.0\r\n"
|
85
|
+
."Content-type: text/html\r\n"));
|
77
86
|
}
|
78
87
|
|
79
88
|
?>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-consulting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moodule
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|