Captcha einbindung

Hallo Community,

bin momentan an einen Plugin dran, bei welchem ich eine neue Benutzermaske anlege.
Gibt es hier eine moeglichkeit ein Captcha einzubinden?

Vielen Dank

Michael

Habe nun folgendes von Shopware uebernommen und in meine index.tpl kopiert.

{*Captcha*}
{block name='frontend_catalogue_captcha'}
    
        {block name='frontend_catalogue_captcha_placeholder'}
            
        {/block}
        {block name='frontend_catalogue_captcha_label'}
            {s name="TellAFriendLabelCaptchaInfo"}{/s}
        {/block}
        {block name='frontend_catalogue_captcha_field_code'}
            
                
            
        {/block}
    
{/block}

Jedoch wird mir jetzt nur der inputbereich angezeigt und nicht das dazugehoerige Bild.

Hat jemand eine Idee?

Wie sieht deine Index.tpl aus? Werden dort die Shopware Javascript Plugins geladen? (speziell das captcha Plugin)

Viele Grüße

Bis jetzt sieht meine index.tpl wie folgt aus:

{extends file='frontend/index/index.tpl'}


    

        {* Sidebar left *}
        {block name='frontend_index_content_left'}
            {include file="frontend/index/sidebar.tpl"}
        {/block}

    
    
                

                    {* Firstname *}
                    {block name='frontend_catalogue_personal_firstname'}
                        
                            
                        
                    {/block}

                    {* Lastname *}
                    {block name='frontend_catalogue_personal_lastname'}
                        
                            
                        
                    {/block}

                    {*Captcha*}
                    {block name='frontend_catalogue_captcha'}
                        

                             Deferred loading of the captcha image
                            {block name='frontend_catalogue_captcha_placeholder'}
                                
                            {/block}

                            {block name='frontend_catalogue_captcha_label'}
                                {s name="TellAFriendLabelCaptchaInfo"}{/s}
                            {/block}

                            {block name='frontend_catalogue_captcha_field_code'}
                                
                                    
                                
                            {/block}

                        
                    {/block}

                    {*Submit button*}
                    {block name='frontend_account_action_button'}
                        
                            
                        
                    {/block}
                
            
        {/block}

 

Nunja, ich glaube es war ein locales Problem.
Nun wird das Bild und der inputbereich angezeigt.
Jedoch fehlt mir jetzt noch die ueberpruefung ob die Eingabe dem Ziffern im Bild entsprechen.
Gibt es hierzu etwas eigenes von Shopware was ich einbinden kann?

@mfischer1620 schrieb:

Jedoch fehlt mir jetzt noch die ueberpruefung ob die Eingabe dem Ziffern im Bild entsprechen.
Gibt es hierzu etwas eigenes von Shopware was ich einbinden kann?

In deinem Controller / Post Dispatch Event Listener:

Request();

// dispatch Event
$request = $arguments->getRequest();

// captcha prüfen
$captcha = str_replace(' ', '', strtolower($request->getParam('sCaptcha'));
$rand = $request->getPost('sRand');
if (empty($rand) || $captcha != substr(md5($rand), 0, 5)) {
    // Captcha invalid... abbrechen
}

 Abgewandelt von hier: https://github.com/shopware/shopware/blob/5.2/engine/Shopware/Controllers/Frontend/Forms.php#L218

Viele Grüße

1 „Gefällt mir“