|
15 | 15 |
|
16 | 16 | <!DOCTYPE html>
|
17 | 17 | <html lang="en-us" xmlns:th="http://www.thymeleaf.org">
|
18 |
| -<head> |
19 |
| - <meta charset="UTF-8" /> |
20 |
| - <title>Comment: reCAPTCHA Demo</title> |
21 |
| - <!-- ATTENTION: reCAPTCHA Example (Client Part 1 of 2) Starts --> |
22 |
| - <!-- See: https://cloud.google.com/recaptcha-enterprise/docs/instrument-web-pages#user-action --> |
23 |
| - <script th:src="@{https://www.google.com/recaptcha/enterprise.js(render=${site_key})}"></script> |
24 |
| - <script type="text/javascript"> |
25 |
| - function handleClick(event) { |
26 |
| - event.preventDefault(); |
27 |
| - grecaptcha.enterprise.ready(async () => { |
28 |
| - const token = await grecaptcha.enterprise.execute( |
29 |
| - "[[${site_key}]]", |
30 |
| - { |
31 |
| - action: "send_comment", |
32 |
| - } |
33 |
| - ); |
34 |
| - await sendComment({ token }); |
35 |
| - }); |
36 |
| - } |
37 |
| - </script> |
38 |
| - <!-- See: https://cloud.google.com/recaptcha-enterprise/docs/create-assessment --> |
39 |
| - <script type="text/javascript"> |
40 |
| - async function sendComment({ comment = "", token }) { |
41 |
| - // Include the token for server-side assessment. |
42 |
| - // Include the user input values from your form to pass to the backend. |
43 |
| - const body = { |
44 |
| - comment, |
45 |
| - token, |
46 |
| - }; |
47 |
| - // Code for fetching the assessment from server-side goes here. |
48 |
| - // Refer to demo app backend code for more information. |
49 |
| - // If you already use a library or framework for event handlers, you |
50 |
| - // can handle events your usual way. |
51 |
| - const score = await fetchServerResponse({ |
52 |
| - body, |
53 |
| - url: "on_comment_submit", |
54 |
| - }); |
55 |
| - // In this demo, the assessment score is displayed in the client. |
56 |
| - // But generally, you should avoid using the assessment response in the |
57 |
| - // client and handle it on the server-side. |
58 |
| - useAssessmentInClient(score); |
59 |
| - } |
60 |
| - </script> |
61 |
| - <!-- ATTENTION: reCAPTCHA Example (Client Part 1 of 2) Ends --> |
62 |
| - <meta name="viewport" content="width=device-width,initial-scale=1" /> |
63 |
| - <meta |
| 18 | + <head> |
| 19 | + <meta charset="UTF-8" /> |
| 20 | + <title>Comment: reCAPTCHA Demo</title> |
| 21 | + <!-- ATTENTION: reCAPTCHA Example (Client Part 1 of 2) Starts --> |
| 22 | + <!-- See: https://cloud.google.com/recaptcha-enterprise/docs/instrument-web-pages#user-action --> |
| 23 | + <script th:src="@{https://www.google.com/recaptcha/enterprise.js(render=${site_key})}"></script> |
| 24 | + <script type="text/javascript"> |
| 25 | + function handleClick(event) { |
| 26 | + event.preventDefault(); |
| 27 | + grecaptcha.enterprise.ready(async () => { |
| 28 | + const token = await grecaptcha.enterprise.execute("[[${site_key}]]", { |
| 29 | + action: "send_comment", |
| 30 | + }); |
| 31 | + await sendComment({ token }); |
| 32 | + }); |
| 33 | + } |
| 34 | + </script> |
| 35 | + <!-- See: https://cloud.google.com/recaptcha-enterprise/docs/create-assessment --> |
| 36 | + <script type="text/javascript"> |
| 37 | + async function sendComment({ comment = "", token }) { |
| 38 | + // Include the token for server-side assessment. |
| 39 | + // Include the user input values from your form to pass to the backend. |
| 40 | + const body = { |
| 41 | + comment, |
| 42 | + token, |
| 43 | + }; |
| 44 | + // Code for fetching the assessment from server-side goes here. |
| 45 | + // Refer to demo app backend code for more information. |
| 46 | + // If you already use a library or framework for event handlers, you |
| 47 | + // can handle events your usual way. |
| 48 | + const score = await fetchServerResponse({ |
| 49 | + body, |
| 50 | + url: "on_comment_submit", |
| 51 | + }); |
| 52 | + // In this demo, the assessment score is displayed in the client. |
| 53 | + // But, you should AVOID using the assessment response in the |
| 54 | + // client and handle it on the server-side. |
| 55 | + useAssessmentInClient(score); |
| 56 | + } |
| 57 | + </script> |
| 58 | + <!-- ATTENTION: reCAPTCHA Example (Client Part 1 of 2) Ends --> |
| 59 | + <meta name="viewport" content="width=device-width,initial-scale=1" /> |
| 60 | + <meta |
64 | 61 | name="description"
|
65 | 62 | content="Explore the different ways of using reCAPTCHA Enterprise to protect web sites and applications."
|
66 |
| - /> |
67 |
| - <link |
| 63 | + /> |
| 64 | + <link |
68 | 65 | href="https://fonts.googleapis.com/css?family=Press+Start+2P"
|
69 | 66 | rel="stylesheet"
|
70 |
| - /> |
71 |
| - <link |
| 67 | + /> |
| 68 | + <link |
72 | 69 | href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
|
73 | 70 | rel="stylesheet"
|
74 |
| - /> |
| 71 | + /> |
75 | 72 | <link
|
76 | 73 | rel="icon"
|
77 | 74 | type="image/x-icon"
|
78 | 75 | href="/demoasset/favicon-e9e3fe3130a875eb.ico"
|
79 | 76 | />
|
80 |
| - <link |
| 77 | + <link |
81 | 78 | rel="icon"
|
82 | 79 | type="image/png"
|
83 | 80 | sizes="16x16"
|
84 | 81 | href="/demoasset/favicon-16x16-e9e3fe3130a875eb.png"
|
85 |
| - /> |
86 |
| - <link |
| 82 | + /> |
| 83 | + <link |
87 | 84 | rel="icon"
|
88 | 85 | type="image/png"
|
89 | 86 | sizes="32x32"
|
90 | 87 | href="/demoasset/favicon-32x32-e9e3fe3130a875eb.png"
|
91 |
| - /> |
92 |
| - <link |
| 88 | + /> |
| 89 | + <link |
93 | 90 | rel="icon"
|
94 | 91 | type="image/png"
|
95 | 92 | sizes="48x48"
|
96 | 93 | href="/demoasset/favicon-48x48-e9e3fe3130a875eb.png"
|
97 |
| - /> |
98 |
| - <link href="/demoasset/global-15fca5ccf020c02b.css" rel="stylesheet" /> |
99 |
| - <link href="/demoasset/demo-81d99a00.css" rel="stylesheet" /> |
100 |
| - <script src="/scripts/demo-a14dc264.js" type="module"></script> |
101 |
| - <script |
102 |
| - async |
103 |
| - defer |
104 |
| - src="/scripts/global-415f8f0291f2f30a.js" |
105 |
| - type="text/javascript" |
106 |
| - ></script> |
107 |
| -</head> |
108 |
| -<body> |
109 |
| -<recaptcha-demo step="comment"> |
110 |
| - <!-- ATTENTION: reCAPTCHA Example (Client Part 2 of 2) Starts --> |
111 |
| - <button onclick="handleClick(event)">Send comment</button> |
112 |
| - <!-- ATTENTION: reCAPTCHA Example (Client Part 2 of 2) Ends --> |
113 |
| -</recaptcha-demo> |
114 |
| -</body> |
| 94 | + /> |
| 95 | + <link href="/demoasset/global-15fca5ccf020c02b.css" rel="stylesheet" /> |
| 96 | + <link href="/demoasset/demo-81d99a00.css" rel="stylesheet" /> |
| 97 | + <script src="/scripts/demo-39df041b.js" type="module"></script> |
| 98 | + <script async defer src="/scripts/global-e680a49614fd8ff8.js" type="text/javascript"></script> |
| 99 | + </head> |
| 100 | + <body> |
| 101 | + <recaptcha-demo step="comment"> |
| 102 | + <!-- ATTENTION: reCAPTCHA Example (Client Part 2 of 2) Starts --> |
| 103 | + <button onclick="handleClick(event)">Send comment</button> |
| 104 | + <!-- ATTENTION: reCAPTCHA Example (Client Part 2 of 2) Ends --> |
| 105 | + </recaptcha-demo> |
| 106 | + </body> |
115 | 107 | </html>
|
0 commit comments