Giter Site home page Giter Site logo

dylandbl / facaptcha Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 1.01 MB

React CAPTCHA, but it's fun

Home Page: https://dylandbl.github.io/faCAPTCHA

HTML 2.27% TypeScript 93.63% CSS 0.48% JavaScript 3.62%
captcha captcha-generator scam-baiting scambaiting custom-captcha react-captcha react-component

facaptcha's Introduction

faCAPTCHA

๐Ÿ‘‰ Try it out: dylandbl.github.io/faCAPTCHA

Screenshot of faCAPTCHA





[fey-kap-chuh]

A functional, configurable, and accessible frontend CAPTCHA for React. The name is a portmanteau of 'fake' and 'CAPTCHA', and was initially an exploration in bad UX, but through development, it became a real and functional CAPTCHA with accessibility features not found in other popular CAPTCHAs. Just be sure to change the helpText.

faCAPTCHA was inspired by scambaiter Kitboga, who uses fake websites or programs to frustrate and waste the time of scammers.

Installation

yarn add facaptcha

or

npm install facaptcha

API

'โš ๏ธ' denotes required props.

โš ๏ธ Property Type Default value Description
allowRetry boolean false Allows the user to retry the CAPTCHA after verification is complete.
captchaTopics string[] See here Topics displayed at the top of the CAPTCHA. Does not work with headerText.
cellsWide number 4 Number of cells in each row.
cellsTall number cellsWide Number of cells in each column.
disabled 'boolean' false Disables the CAPTCHA, preventing users from attempting verification. disabled is true if the user exceeds maxAttempts.
โš ๏ธ imgTopicUrls ImgTopicType[] - Array of image URLs with associated topic tags.
headerText string See here Used in place of the CAPTCHA header text. Overrides captchaTopic.
helpText string See here Used in place of the default help text, shown when the '?' icon is clicked.
helpButtonAriaLabel string "Help" Used as both the title and aria-label for the '?' icon button.
maxAttempts number minAttempts + 7 Maximum number of attempts. If exceeded, disabled is set to true and onMaxAttempts is called.
minAttempts number 1 Minimum number of required attempts, regardless of whether the attempts are correct or not.
notARobotText string "I'm not a robot" Used in place of the "I'm not a robot" text.
onClickCheckbox () => void - Called on clicking the checkbox. Does not execute if the CAPTCHA popup is open.
onClickVerify () => void - Called on clicking the 'Verify' button.
onMaxAttempts () => void - Called when maxAttempts is exceeded.
onRefresh () => void - Called on clicking the refresh icon.
refreshButtonAriaLabel string "Try a new challenge" Used as both the title and aria-label for the refresh icon button.
โš ๏ธ onVerificationComplete () => void - Called on successful verification completion.
simulateSlow 0 - 3 1 Simulates a slow internet connection speed.
uncloseable boolean false Prevents the CAPTCHA from being closed until verification is complete.
verifyText string "verify" Text for the 'Verify' button.

captchaTopics

An array of case-sensitive topics, from which one item will be randomly selected. The topic appears in the header of the CAPTCHA and it is the phrase or word that the image tags will be compared to. If not defined, a pseudorandomly selected default value will be used.

imgTopicUrls

Topic tags are case-sensitive and compared to the topic selected from captchaTopics. The images will be displayed in order. If there are fewer images than cells, the images will repeat.

ImgTopicType

type ImgTopicType = {
  url: string;
  topics: string[];
}

Example

const ExampleImages: ImgTopicType[] = [
  {
    url: "https://upload.wikimedia.org/wikipedia/commons/b/b0/Canthigaster_valentini_1.jpg",
    topics: ["pufferfish", "fish", "Canthigaster valentini"]
  },
  {
    url: "https://upload.wikimedia.org/wikipedia/commons/1/11/Joseph_Grimaldi.jpg",
    topics: ["clown"]
  }
]

headerText default value

Select all squares with
${captchaTopic}
If there are none, click ${verifyText}

helpText default value

Click on the images that correspond with the given prompt. Once you've selected all applicable images, click '${verifyText}'. If you make multiple wrong attempts in a row, you will be barred from accessing the site. The number of wrong attempts permitted depends on your browsing behaviour. If you complete an entire row, column, or diagonal, you have a bingo. Shout 'bingo' into your microphone to access the site.

simulateSlow

Simulates a slow connection speed. A value of 0 will not create artificial load times. A value of 1 or greater will render load screens between CAPTCHA attempts and on clicking the component's refresh icon. The load time is randomly generated based on the value given, with higher values generating higher average load times.

facaptcha's People

Contributors

dependabot[bot] avatar dylandbl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

facaptcha's Issues

[BUG] [Example] Footer floats in middle of screen when entering inputs on mobile

  • Mobile ๐Ÿ“ฑ
  • Desktop ๐Ÿ–ฅ
  • Component
  • Demo site

Describe the bug
When editing configuration values on mobile with the on-screen keyboard, the footer jumps up and floats in the middle of the screen.

Steps to reproduce the behavior:

  1. Open the demo site on mobile
  2. Open the configuration settings
  3. Tap on one of the inputs to enter a value
  4. When the keyboard appears, the footer will be floating in the middle of the screen

Expected behavior
The footer should be at the bottom of the page, hidden below the keyboard

[FEAT] Remove large checkmark in demo site when clicked again.

  • Demo site
  • CAPTCHA

Is your feature request related to a problem? Please describe.
In the demo site, users may want to open try the CAPTCHA repeatedly. Even though it's intended design, it seems like a mistake to keep the large checkmark when the CAPTCHA is attempted a second time.

Summarize the feature you would like
Remove the checkmark when clicked again.

[FEAT] Maximum number of attempts

  • Demo site
  • CAPTCHA

Is your feature request related to a problem? Please describe.
Infinite attempts would allow solving by means of brute force.

Summarize the feature you would like
A maxAttempts?: number prop. If set, users would not be allowed to exceed that number of attempts. Perhaps also a function called when maxAttempts is exceeded to tell the site it has been surpassed, allowing the site to handle the situation however they deem fit.

[BUG] [Example] Footer does not stay at the bottom of the screen

  • Mobile ๐Ÿ“ฑ
  • Desktop ๐Ÿ–ฅ

Describe the bug
On the mobile site, the footer does not stay at the bottom of the screen when the CAPTCHA is opened.

Steps to reproduce the behavior:

  1. On mobile, open the CAPTCHA.
  2. Scroll down.
  3. The footer will be floating behind the CAPTCHA popup, not at the bottom of the screen.

Expected behavior
The footer should sit at the very bottom of the site.
Screenshot 2022-07-02 235335

[BUG] Passing incorrect array type into `imgTopicUrls` crashes site

  • Mobile ๐Ÿ“ฑ
  • Desktop ๐Ÿ–ฅ
  • Component
  • Demo site

Describe the bug
Passing an empty array into the component crashes the app.

Steps to reproduce the behavior:

  1. Add FaCaptcha to a project
  2. Pass an empty array through imgTopicUrls:
<FaCaptcha imgTopicUrls={[]} />
  1. Run the app
  2. It crashes

Expected behavior
The component should include graceful error handling to prevent crashing when the array is not synonymous with the ImgTopicType.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.