PHPackages                             crevillo/ezplatform-captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. crevillo/ezplatform-captcha

ActiveBundle

crevillo/ezplatform-captcha
===========================

Repository dedicated add captcha to some parts of eZ Platform

v0.8.0(6y ago)23.9k3GPL-2.0-onlyPHPPHP ^7.1CI failing

Since Jun 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/crevillo/ezplatform-captcha)[ Packagist](https://packagist.org/packages/crevillo/ezplatform-captcha)[ RSS](/packages/crevillo-ezplatform-captcha/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (16)Used By (0)

eZ Platform Captcha
===================

[](#ez-platform-captcha)

One of the request me and my teammates at The Cocktail receive in the last times is to have a captcha mechanism in the admin login form and also in the recover password form.

This bundle allows this possibility taking advantage of the gregwar/captcha-bundle and gregwar-captcha packages.

What this bundle does
=====================

[](#what-this-bundle-does)

To add captcha to those forms, it works different depending on the form

### login form

[](#login-form)

in eZ Platform, login form is not a `Symfony Form`. Instead, is a normal form that you can see in the [login.html.twig](https://github.com/ezsystems/ezplatform-admin-ui/blob/1.5/src/bundle/Resources/views/Security/login.html.twig) template.

This makes impossible to extend this from from a php class. This is why, this bundles adds is own security controller and templates, so the captcha can be shown

When the login\_form option for the bundle is set to true, the compiler pass will change some definitions.

In the SecurityController we use the Captcha library to create the captcha image. This image is sent to the template. Besides, once is generated, the phrase is stored in session.

There's also an override for the *UsernamePasswordFormAuthenticationListener* that checks for this session variable and compares its value to the one provided in the form field.

If there's no match, a exception is thrown. If there's, all goes as before.

### forgot password form

[](#forgot-password-form)

On the other hand, there's a symfony form for the forgot password functionality. So, in this case we opt to add a Form Type Extension that will add a Captcha Field Type.

This Form Type Extension is only added to the container when the option is enabled.

Install
=======

[](#install)

To install this bundle require this package with composer

`composer require crevillo/ezplatform-captcha`

then, you will need to enable the Gregwar Captcha Bundle and also this bundle in your AppKernel file

```
