jekyll-theme-consulting 0.10.3 → 0.10.8

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: cf4b346828d9745cd0d92091c845db875f04036618372d32d58c29e025422ad9
4
- data.tar.gz: 411b6948e3a4c218b4a579dd8c8376722ebf51a330fdbb2add99a2947001c54d
3
+ metadata.gz: 61451966bf71c92fb1c654269258b3ef93ffe5ce4a5006332cc1470ca473f9fb
4
+ data.tar.gz: a6035dcb10c0c86d9217d7bc9bb6a2d352f842407fb00991ef655bdaf89cccba
5
5
  SHA512:
6
- metadata.gz: a475fcc6994e78e1fd36047ffa70c4640ca5f8f179f0520ffa441ef7a21fcb037f88574517788bacd3f1a52aa1f35055a81aa86dc3fb43ba475a42fe9250c293
7
- data.tar.gz: e702de5b269e20bd6d0150c3df6e449aba94a3a328b68af822bf0278e5e3e6b85436d819a76977e195c011a68fd75f37ec62dce32acb90be8466967d1c070e7d
6
+ metadata.gz: a5ac036008412269e38ebabab480292cb88130c146475df3bce4f17b4394ba3e7e32f1823869ba123c5548f2a0020a159bdd146d15faf859ef873d579240040c
7
+ data.tar.gz: c8cf966dcab7b1dc64286b3b70dcbd55dfa42b0164dde72c70771fc28cf890a5dfbd630e06634c3e566b34067aa5392db1b25849b7e4493c656495c35d4b36ae
@@ -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,35 +1,38 @@
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 = urldecode(filter_var(
12
15
  $_POST["name"],
13
- FILTER_SANITIZE_FULL_SPECIAL_CHARS);
14
- $email = filter_var(
16
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS));
17
+ $contact_email = urldecode(filter_var(
15
18
  $_POST["email"],
16
- FILTER_SANITIZE_EMAIL);
17
- $message = filter_var(
19
+ FILTER_SANITIZE_EMAIL));
20
+ $contact_message = urldecode(filter_var(
18
21
  $_POST["message"],
19
- FILTER_SANITIZE_FULL_SPECIAL_CHARS);
22
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS));
20
23
  $token = filter_var(
21
24
  $_POST["token"],
22
25
  FILTER_SANITIZE_URL);
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
32
  if (is_recaptcha_valid($token)) {
30
- send_mail($name, $email, $message);
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.3
4
+ version: 0.10.8
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-12 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll