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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69e6ed8a4f554d2c4b74d4640ab120e85ab0ae09e8c77cf4dbd5ea83d66f322b
4
- data.tar.gz: f4e9374cb05b29fbfba15529c8c4b9c4bb0fd9887fb27f18a3d194bd8b1f5287
3
+ metadata.gz: 347a757205a09656983285677789e0cbec55f65554c35d599e377a791df5f038
4
+ data.tar.gz: 88e7ac638a75e585d5fd40bcf98b01317eddaac19468745bba87d7d8dbcf5b59
5
5
  SHA512:
6
- metadata.gz: 598f6755974843cafdaa78bbfaeec04bc18b2ab7cc65466afc2e2d5cfb9fab6dc63c53b043c1d1a42e5eba829125ddefcf0210dc158671e4f11db8d69de3debb
7
- data.tar.gz: c4764a57651719dd683b7f27919907432710dc303a2eb88848782123ffabb6625f8d5aa2d7f94f6f07eb405f52a0c88a765d56925ef8b597f72d9698953b9322
6
+ metadata.gz: 36b05b7ef191bba9782cc431bab31e2ea187da12dea2103c558c04278379436ecef3fe88c8e44628cc976ba036357dfeb2eda241a5d379154082a9c2321791e5
7
+ data.tar.gz: b6f5f055e3d20ca026a0d1008670344474c2b989fb1b5b6731248aed0d291347f43d17d552664077b144443fb82b5db6ec162924b8625dfac7dc262a552786b9
@@ -54,25 +54,17 @@
54
54
  };
55
55
 
56
56
  const sendContactMessage = function() {
57
- const data = {
58
- name: encodeURIComponent(nameInputElement.value),
59
- email: encodeURIComponent(emailInputElement.value),
60
- message: encodeURIComponent(messageInputElement),
61
- token: grecaptcha.getResponse(recaptchaWidget)
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
- mode: 'same-origin',
67
- headers: {'Content-Type': 'application/json',},
68
- body: JSON.stringify(data),
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);
@@ -1,20 +1,23 @@
1
1
  ---
2
2
  permalink: /contact.php
3
- subject: Contact request
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
- $name = $email = $message = $token = $ip = "";
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
- $name = filter_var(
14
+ $contact_name = filter_var(
12
15
  $_POST["name"],
13
16
  FILTER_SANITIZE_FULL_SPECIAL_CHARS);
14
- $email = filter_var(
17
+ $contact_email = filter_var(
15
18
  $_POST["email"],
16
19
  FILTER_SANITIZE_EMAIL);
17
- $message = filter_var(
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
- $ip = $_SERVER['REMOTE_ADDR'];
29
+ $contact_ip = $_SERVER['REMOTE_ADDR'];
27
30
  }
28
31
 
29
- if is_recaptcha_valid($token) {
30
- send_mail($name, $email, $message);
32
+ if (is_recaptcha_valid($token)) {
33
+ send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
31
34
  } else {
32
- send_mail($name, $email, "Got a fishy request from ".$ip)
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
- $message."\r\n\nFrom: ".$name." @ ".$ip,
76
- "From: ".$name." <".$email.">\r\nMIME-Version: 1.0\r\nContent-type: text/html\r\n");
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.2
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-07 00:00:00.000000000 Z
11
+ date: 2020-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll