Coder Social home page Coder Social logo

rvxlab / hcaptcha Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scyllaly/hcaptcha

23.0 23.0 0.0 191 KB

hCaptcha for Laravel 8.x and later

License: MIT License

PHP 89.94% Makefile 2.59% Dockerfile 2.48% Blade 1.05% HTML 3.94%
captcha hcaptcha laravel laravel-packages

hcaptcha's Introduction

Hey!

I'm RVxLab, a full-stack developer in Queensland, Australia.

Some of my projects

A TailwindCSS plugin to help dealing with 100vh in Safari for iOS and iPadOS.

Download through NPM

A drop-in replacement fork of Scyllaly's HCaptcha package with modernized code, improved tests and a few more features.

Download through Composer

A plugin for Laravel Filament that wraps Vanilla Picker into a component.

As of the 21st of April 2022 this package has been deprecated as Filament has a built-in colour picker now.

nova-tabs (maintainer of 3.x)

A plugin for Laravel Nova to show tabs on a resource's detail and edit pages.

Created by Bajram Emini and version 3.x was maintained by me.

Version 4.x is being maintained by Marc Filipan.

Download through Composer

Some stats

Show me!

My repo stats

My most used languages

hcaptcha's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar rubensrocha avatar rvxlab avatar scyllaly avatar tofandel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hcaptcha's Issues

Add a proper fake on the facade

Instead of needing to manually mock the display and verify calls, it's nice to be able to just call HCaptcha::fake() and have it automatically set some reasonable defaults.

This will require the introduction of a contract:

interface HCaptchaContract
{
    public function display(array $attributes = []): string;

    public function displayWidget(array $attributes = []): string;

    public function displaySubmit(string $formIdentifier, string $buttonText = 'submit', array $attributes = []): string;

    public function renderJs(?string $lang = null, bool $hasCallback = false, string $onLoadClass = 'onloadCallBack'): string;

    public function verifyResponse(string $response, ?string $clientIp = null): bool;

    public function verifyRequest(Request $request): bool;

    public function getJsLink(?string $lang = null, bool $hasCallback = false, string $onLoadClass = 'onloadCallBack'): string;
}

For the fake, any of the display methods can return an input with any value, so it can be rendered and form validation will succeed.

The getJsLink method can just return an empty string, that's not really important here.

The verify methods should return true by default with the option to mock that call as needed by means of a shouldVerify(bool) or a successfullyVerifies() and failsVerification() pair.

Lag when using invisible widget

I copied the example invisible widget into my application, when clicking the button it takes about 5 seconds before the captcha shows up, and it skips over my form validation.

Edit: Seems hCaptcha is just slow... Would there be a way to add a class to the button, just as disabled, when the hCaptcha is loading, or to show a loading bar.

My form still does not get validated when clicking the button, I'm using MaterializeCSS

Extract HTML generation into views

HTML is currently generated in the HCaptcha class. It's better to extract them to separate views to they can be published.

Widget (HCaptcha::display)

Should be moved to widget.blade.php

Submit (HCaptcha::displaySubmit)

This needs to be split into 2 files:

  • submit.blade.php
  • default-submit-callback.blade.php

Script (HCaptcha::renderJs)

Should be moved to script.blade.php

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.