jekyll-theme-consulting 0.9.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 932d49ffa22e1d3d7d193480335d1a4454c4019b9c4b6e06a87e821b68e75093
4
- data.tar.gz: 855a9305e80a249deb69b534496f6266a0f7583a505c388ff1cbe1c5dc8fe72c
3
+ metadata.gz: 606108f5aa0396efdd45e7c86cb130e6b2e178f877b427c620572206b412c60d
4
+ data.tar.gz: ddfdf3ae14502e3b2d99b9fe685686e5596da4ca2125bdd6967845631a546f35
5
5
  SHA512:
6
- metadata.gz: 20bdc93735275156c2b1039b236863339ffe614478b94801d9a57185e1b1791b826aa063f209030689d7b44fffa39acb45959eeddd8d8e82d6602aaad57df709
7
- data.tar.gz: cc20b071e41e1d54dde82e786fafee7c89d23f76d8cf7e61a028a0de087579828e79e7f9877255341983835cf2d517ecbaed1cfc5611e456b084e6ed50b6a4b6
6
+ metadata.gz: f31332096f41bdfc8f23ee87c00b55886b8cb777f7482efc052540dfd2197aad1e2302da2d4680155d57f86b5dc3c4938a61f6cbce0a2f1613bd67f0b1c701fa
7
+ data.tar.gz: 5223040f1b057537680fca1b9875f19f5d507a55f38c11a124741d451b4841fc409276b575c59ee5585ad001a65238c4b3a1765c06fb5fc4c6f055ae0358af55
@@ -27,4 +27,4 @@
27
27
  </div>
28
28
  </section>
29
29
 
30
- {% include contact_script.html form_id=form_id name_input_id=name_input_id email_input_id=email_input_id message_input_id=message_input_id submit_input_id=submit_input_id reset_input_id=reset_input_id recaptcha_widget_id=recaptcha_widget_id onsubmit_callback=onsubmit_callback onreset_callback=onreset_callback onfocusout_callback=onfocusout_callback %}
30
+ {% include contact_client_script.html form_id=form_id name_input_id=name_input_id email_input_id=email_input_id message_input_id=message_input_id submit_input_id=submit_input_id reset_input_id=reset_input_id recaptcha_widget_id=recaptcha_widget_id onsubmit_callback=onsubmit_callback onreset_callback=onreset_callback onfocusout_callback=onfocusout_callback %}
@@ -61,7 +61,7 @@
61
61
  token: grecaptcha.getResponse(recaptchaWidget)
62
62
  };
63
63
 
64
- fetch("{{ '/contact' | absolute_url }}", {
64
+ fetch("{{ '/contact.php' | absolute_url }}", {
65
65
  method: 'POST',
66
66
  mode: 'same-origin',
67
67
  headers: {'Content-Type': 'application/json',},
@@ -0,0 +1,70 @@
1
+ <?php
2
+
3
+ $name = $email = $message = $token = "";
4
+
5
+ if ($_SERVER["REQUEST_METHOD"] == "POST") {
6
+ if (has_required_data($_POST)) {
7
+ $name = filter_var(
8
+ $_POST["name"],
9
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS);
10
+ $email = filter_var(
11
+ $_POST["email"],
12
+ FILTER_SANITIZE_EMAIL);
13
+ $message = filter_var(
14
+ $_POST["message"],
15
+ FILTER_SANITIZE_FULL_SPECIAL_CHARS);
16
+ $token = filter_var(
17
+ $_POST["token"],
18
+ FILTER_SANITIZE_URL);
19
+
20
+ if is_recaptcha_valid($token) {
21
+ send_mail($name, $email, $message);
22
+ } else {
23
+ send_mail($name, $email, "Is fishy.")
24
+ }
25
+ }
26
+ }
27
+
28
+ function has_required_data($request) {
29
+ return (
30
+ (
31
+ isset($request['name'])
32
+ && isset($request['email'])
33
+ && isset($request['message'])
34
+ && isset($request['token']))
35
+ && (
36
+ !empty($request['name'])
37
+ && !empty($request['email'])
38
+ && !empty($request['message'])
39
+ && !empty($request['token']))
40
+ );
41
+ }
42
+
43
+ function is_recaptcha_valid($token) {
44
+ $validation_url = "https://www.google.com/recaptcha/api/siteverify";
45
+ $data = array('secret' => '{{ site.recaptcha.secretkey }}', 'response' => $token);
46
+ $options = array(
47
+ 'http' => array(
48
+ 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
49
+ 'method' => 'POST',
50
+ 'content' => http_build_query($data)
51
+ )
52
+ );
53
+ $context = stream_context_create($options);
54
+ $result = json_decode(file_get_contents($validation_url, false, $context));
55
+
56
+ return (
57
+ ($result !== FALSE)
58
+ && isset($result->success)
59
+ && $result->success);
60
+ }
61
+
62
+ function send_mail ($name, $email, $message) {
63
+ return mail(
64
+ "{{ site.email }}",
65
+ "{{ include.subject | default: 'Contact request' }}",
66
+ $message,
67
+ "From: ".$name." <".$email.">\r\nMIME-Version: 1.0\r\nContent-type: text/html\r\n");
68
+ }
69
+
70
+ ?>
@@ -27,7 +27,7 @@ $font: (
27
27
  family-heading: ('Roboto Slab', serif),
28
28
  family-fixed: ('Courier New', monospace),
29
29
  weight: 400,
30
- weight-bold: 600,
30
+ weight-bold: 900,
31
31
  weight-heading: 700,
32
32
  weight-heading-alt: 400,
33
33
  kerning-heading: 0.075em
@@ -40,7 +40,7 @@ $palette: (
40
40
  bg-inverted: #6666ff,
41
41
  bg-alt-inverted: #223344,
42
42
  fg: #000000,
43
- fg-bold: #3d4449,
43
+ fg-bold: #000000,
44
44
  fg-light: #9fa3a6,
45
45
  fg-inverted: #ffffff,
46
46
  fg-bold-inverted: #ffffff,
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.9.10
4
+ version: 0.10.0
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-05 00:00:00.000000000 Z
11
+ date: 2020-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -77,8 +77,9 @@ files:
77
77
  - README.md
78
78
  - _includes/banner.html
79
79
  - _includes/contact.html
80
+ - _includes/contact_client_script.html
80
81
  - _includes/contact_form.html
81
- - _includes/contact_script.html
82
+ - _includes/contact_server_script.php
82
83
  - _includes/date.html
83
84
  - _includes/fact.html
84
85
  - _includes/feature.html