jekyll-theme-consulting 0.10.1 → 0.10.6

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: 17ca15a34984ff88be827b0e3669dd7f8edcb5b94699a9eff382b513e1ff0a84
4
- data.tar.gz: 56f338f8a0af42f63a87687790791fca07666a5aa96e65c5ab4a5e25554ddbbc
3
+ metadata.gz: 37ee0b2db3e3d8f52b751a575ca96ae422803c6331449ccc6db21bf8e5992f7c
4
+ data.tar.gz: 944e65b0385226d3183eff1bd604d92f6d93153d9e8fdeff4dbf7e9288179fda
5
5
  SHA512:
6
- metadata.gz: b92a7b6ff45e3809d5a7cbab7e279a4f5f017a0386a7ea7afd073b4eac41d2238a6bdfbf803d721d2ae8bb35c5cfeaffee5e82c942b03240506fb0c6359015f9
7
- data.tar.gz: c4ec1fc7bdcb7e8619d542f5f97f24b1ae1d4ae6a117b87db24764c73dbe8451f23f87526f58e870b94f41f330a8f5155a8b9ce9b75661c7e833c3f8ba481ca7
6
+ metadata.gz: eeb1cf9d5d85fa5b241ecbe94538ac6c60d705548096ca758b3f8c18f336624946c0751dc6e022585801380bfc987f493ef98c82ab482ddd3a88629cdee37ff4
7
+ data.tar.gz: 74de75686d4508d26a40ef3df06abe78634ebd494aa6bb1709aaba1b7730e26874e570799fd1163c0d2f9fb838ed383b07cafdf37fe700c703b0329a455085c7
@@ -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', encodeURIComponent(nameInputElement.value));
59
+ formData.append('email', encodeURIComponent(emailInputElement.value));
60
+ formData.append('message', encodeURIComponent(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,19 +1,23 @@
1
1
  ---
2
- layout: null
2
+ permalink: /contact.php
3
+ mail:
4
+ subject:
5
+ intro:
3
6
  ---
7
+ {%- capture mail-intro -%}You received a message on <a href='{{ site.url }}'>your website</a>.{%- endcapture -%}
4
8
  <?php
5
9
 
6
- $name = $email = $message = $token = $ip = "";
10
+ $contact_name = $contact_email = $contact_message = $token = $contact_ip = "";
7
11
 
8
12
  if ($_SERVER["REQUEST_METHOD"] == "POST") {
9
13
  if (has_required_data($_POST)) {
10
- $name = filter_var(
14
+ $contact_name = filter_var(
11
15
  $_POST["name"],
12
16
  FILTER_SANITIZE_FULL_SPECIAL_CHARS);
13
- $email = filter_var(
17
+ $contact_email = filter_var(
14
18
  $_POST["email"],
15
19
  FILTER_SANITIZE_EMAIL);
16
- $message = filter_var(
20
+ $contact_message = filter_var(
17
21
  $_POST["message"],
18
22
  FILTER_SANITIZE_FULL_SPECIAL_CHARS);
19
23
  $token = filter_var(
@@ -22,13 +26,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
22
26
  if (filter_var(
23
27
  $_SERVER['REMOTE_ADDR'],
24
28
  FILTER_VALIDATE_IP)) {
25
- $ip = $_SERVER['REMOTE_ADDR'];
29
+ $contact_ip = $_SERVER['REMOTE_ADDR'];
26
30
  }
27
31
 
28
- if is_recaptcha_valid($token) {
29
- send_mail($name, $email, $message);
32
+ if (is_recaptcha_valid($token)) {
33
+ send_mail($contact_name, $contact_email, $contact_message, $contact_ip);
30
34
  } else {
31
- 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);
32
36
  }
33
37
  }
34
38
  }
@@ -44,8 +48,7 @@ function has_required_data($request) {
44
48
  !empty($request['name'])
45
49
  && !empty($request['email'])
46
50
  && !empty($request['message'])
47
- && !empty($request['token']))
48
- );
51
+ && !empty($request['token'])));
49
52
  }
50
53
 
51
54
  function is_recaptcha_valid($token) {
@@ -55,9 +58,7 @@ function is_recaptcha_valid($token) {
55
58
  'http' => array(
56
59
  'header' => "Content-type: application/x-www-form-urlencoded\r\n",
57
60
  'method' => 'POST',
58
- 'content' => http_build_query($data)
59
- )
60
- );
61
+ 'content' => http_build_query($data)));
61
62
  $context = stream_context_create($options);
62
63
  $result = json_decode(file_get_contents($validation_url, false, $context));
63
64
 
@@ -67,12 +68,22 @@ function is_recaptcha_valid($token) {
67
68
  && $result->success);
68
69
  }
69
70
 
70
- function send_mail ($name, $email, $message) {
71
+ function send_mail ($name, $email, $message, $ip) {
71
72
  return mail(
72
73
  "{{ site.email }}",
73
- "{{ site.subject | default: 'Contact request' }}",
74
- $message."\r\n\nFrom: ".$name." @ ".$ip,
75
- "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"));
76
86
  }
77
87
 
78
88
  ?>
89
+
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.1
4
+ version: 0.10.6
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
@@ -98,6 +98,7 @@ files:
98
98
  - _includes/toggle.html
99
99
  - _includes/waves/bottom.html
100
100
  - _includes/waves/top.html
101
+ - _layouts/contact.html
101
102
  - _layouts/default.html
102
103
  - _layouts/home.html
103
104
  - _layouts/index.html
@@ -279,7 +280,6 @@ files:
279
280
  - assets/webfonts/fa-solid-900.ttf
280
281
  - assets/webfonts/fa-solid-900.woff
281
282
  - assets/webfonts/fa-solid-900.woff2
282
- - contact.php
283
283
  homepage: https://github.com/moodule/jekyll-theme-consulting
284
284
  licenses:
285
285
  - CC-BY-NC-SA-4.0