@contentgrowth/content-auth 0.3.3 → 0.3.4
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.
package/dist/backend/index.js
CHANGED
|
@@ -33,11 +33,21 @@ async function verifyTurnstile(secretKey, token, remoteIp) {
|
|
|
33
33
|
},
|
|
34
34
|
body: formData.toString()
|
|
35
35
|
});
|
|
36
|
+
let result;
|
|
37
|
+
try {
|
|
38
|
+
result = await response.json();
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(`[Turnstile] Failed to parse response: ${response.status}`);
|
|
41
|
+
return { success: false, error: "Security verification failed. Please try again." };
|
|
42
|
+
}
|
|
36
43
|
if (!response.ok) {
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
const errorCodes = result["error-codes"] || [];
|
|
45
|
+
console.error(`[Turnstile] Siteverify API error ${response.status}: ${errorCodes.join(", ")}`);
|
|
46
|
+
if (errorCodes.length > 0) {
|
|
47
|
+
return { success: false, error: mapTurnstileError(errorCodes) };
|
|
48
|
+
}
|
|
49
|
+
return { success: false, error: "Security verification failed. Please try again." };
|
|
39
50
|
}
|
|
40
|
-
const result = await response.json();
|
|
41
51
|
if (result.success) {
|
|
42
52
|
return { success: true, hostname: result.hostname };
|
|
43
53
|
} else {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentgrowth/content-auth",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages. Includes Turnstile bot protection and email normalization.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|