
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@aacn.eu/use-friendly-captcha
Advanced tools
The library has functions for both frontend and backend. Both of them work independent of each other.
Include the useCaptchaHook()
in your selected file. From there you can then query the widget
and state from the hook, for you to manage and use in your form.
Please be aware that the friendly-challenge
library is a necessary peer dependency since version 1.2.0
The hook expects the following properties:
siteKey: string;
endpoint?: FC_PUZZLE_EP; enum for the currently available endpoints (EU & global)
language?: keyof typeof localizations | Localization;
startMode?: "auto" | "focus" | "none";
showAttribution: boolean;
CaptchaWidget custom props
When the CaptchaWidget
gets rendered, you can add additional properties:
props: HTMLAttributes
This includes all possible html attributes. Therefor this is the entry point to add the className
attribute,
to add custom styling to the outer captcha container. Here can you either directly add TailwindCSS classes or define a custom class for
future styling in the .css file of the project.
customWidgetStyle
allows up to three attributes for specific stylings that are directly applied to the components:
icon
The icon of the widgetbutton
The submit button of the widgettext
All text elements that appear inside the widget
CustomWidgetStyle = { icon: {color: "green", background: "yellow"}, text: {color: "blue"} }
backend wise this library provides a function that uses the FriendlyCaptcha verification API to check if the submitted puzzle solution is valid or not. It returns a boolean for further handling in your own code.
The function expects the following properties:
endpoint?: FC_VERIFICATION_EP; enum for the currently available endpoints (EU & global)
solution: string;
secret: string;
sitekey?: string;
httpPostFetcher: (see further down)
The backend expects a fetcher function as parameter. This function is provided by the user and is used to send a http post request to the fc verification server. It should match the following design:
function fetcherExample(
endpoint: string,
requestBody: { solution: string; secret: string; siteKey: string },
headers: { 'Content-Type': 'application/json'; 'Accept': 'application/json'; }
) => Promise<{ success: boolean; errors: any; } | null>
We provided basic examples in the /examples
folder, on how to use this library in React and Nextjs.
Both examples are written in TypeScript and are kept simple to focus on easy readability and presenting the utility of the function from this library.
If you want to run the examples on your machine, make sure to read the respective README files,
to add all requirements that are needed.
v1.3.0
FAQs
FriendlyCaptcha React Implementation
The npm package @aacn.eu/use-friendly-captcha receives a total of 1,439 weekly downloads. As such, @aacn.eu/use-friendly-captcha popularity was classified as popular.
We found that @aacn.eu/use-friendly-captcha demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.