captcha icon indicating copy to clipboard operation
captcha copied to clipboard

Automatically add captcha route is a bad idea

Open ElfSundae opened this issue 9 years ago • 4 comments

The CaptchaServiceProvider adds a captcha route for the whole app, I think the routing work should be done by developers.

ElfSundae avatar Jun 21 '16 21:06 ElfSundae

i have the same view

funway avatar Jun 28 '16 15:06 funway

yaaaap, this is really bad idea

neuronetpl avatar Oct 31 '16 11:10 neuronetpl

A solution: override the service provider.

<?php

namespace App\Providers;

use Mews\Captcha\CaptchaServiceProvider as ServiceProvider;

class CaptchaServiceProvider extends ServiceProvider
{
    /**
     * Override the Captcha service provider to remove the default routing.
     */
    public function boot()
    {
        $this->publishes([
            base_path('vendor/mews/captcha/config/captcha.php') => config_path('captcha.php'),
        ], 'config');

        $this->app['validator']->extend('captcha', function ($attribute, $value, $parameters) {
            return captcha_check($value);
        });
    }
}

Then, replace the provider Mews\Captcha\CaptchaServiceProvider::class with App\Providers\CaptchaServiceProvider::class in config/app.php file.

ElfSundae avatar Nov 06 '16 11:11 ElfSundae

This repo seems to be suspended, I created a patched package https://github.com/ElfSundae/laravel-captcha 😄

ElfSundae avatar Sep 11 '17 02:09 ElfSundae