Sitefinity 6.2 Captcha for Forms

Posted by Community Admin on 05-Aug-2018 15:03

Sitefinity 6.2 Captcha for Forms

All Replies

Posted by Community Admin on 01-Aug-2013 00:00

PROBLEM

Currently, there is no way to enable captcha in Forms through the backend interface.
PITS: http://www.telerik.com/support/pits.aspx#/details/Issue=10655

USER STORIES

Forms Backend
As a user in Forms, in a form Settings section I should see an option to enable captcha. The option is not selected by default.  See screenshot

Forms Frontend (MUST) 
Once enabled, this option will display captcha control upon submission to this form. Captcha should not display to authenticated users.

Advanced Settings (MUST)
As a developer in Advanced settings, I see option to edit the properties for the Telerik RadCaptcha control. When I edit some settings, these are applied on all places where captcha is used.

Basic Settings (SHOULD)
As a user in Basic settings, I see option to edit Captcha settings for the site via the interface. The following options should be present:
http://demos.telerik.com/aspnet-ajax/captcha/examples/overview/defaultcs.aspx

Extensibility (MUST)
As a developer I should be able to add RadCaptcha to any custom form on the site. I should see an example on how to add and configure it.  

QUESTIONS:  
Is there a request which this implementation doesn't cover ?


Best,
- Kalina

Posted by Community Admin on 01-Aug-2013 00:00

WOOHOO!  Guess I don't need to include this with my controls in 6.2 now :)

Why do we need a checkbox to enable it?  Wouldn't just having it in the toolbox to drag and drop suffice?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
using Telerik.Microsoft.Practices.EnterpriseLibrary.Logging;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Modules.Forms;
using Telerik.Sitefinity.Modules.Forms.Web.UI;
using Telerik.Sitefinity.Modules.Forms.Web.UI.Fields;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Web.UI;
using Telerik.Sitefinity.Web.UI.Fields;
using Telerik.Web.UI;
 
namespace RandomSiteControls.Forms
    /// <summary>
    /// Add the captcha control to your toolbox like this
    ///     <toolbox name="FormControls">
    ///         <sections>
    ///             <add name="Common">
    ///                 <tools>
    ///                     <add enabled="True" type="Telerik.Web.UI.RadCaptcha, Telerik.Web.UI" title="RadCaptcha" description="RadCaptcha" visibilityMode="None" name="RadCaptcha" />
    ///                 </tools>
    ///             </add>
    ///         </sections>
    ///     </toolbox>
    /// </summary>
    public class FormCaptcha : FormsControl
    
        protected override void InitializeControls(GenericContainer container)
        
            if (!SystemManager.IsDesignMode)
            
                //Hide the form if JS is disabled, it'll let them bypass the required fields.
                base.InitializeControls(container);
                this.BeforeFormSave += new EventHandler<CancelEventArgs>(FormsControlCustom_BeforeFormSave);
            
        
 
 
        #region EVENTS
        protected void FormsControlCustom_BeforeFormSave(object sender, CancelEventArgs e)
        
            if (this.MyCaptcha != null)
            
                if (!this.MyCaptcha.IsValid)
                
                    e.Cancel = true;
                    this.MyCaptcha.ErrorMessage = this.CaptchaErrorMessage;
                
            
        
 
        #endregion
 
        #region METHODS
 
        #endregion
 
        #region Properties
        private RadCaptcha _captcha = null;
        protected RadCaptcha MyCaptcha
        
            get
            
                if (!SystemManager.IsDesignMode)
                
                    foreach (var control in this.FormControls.Controls[1].Controls)
                    
                        if (control.GetType() == typeof(RadCaptcha))
                        
                            _captcha = control as RadCaptcha;
                            break;
                        
                    
                
 
                return _captcha;
            
        
 
        private string _captchaErrorMessage = "Invalid Code, please try again";
        /// <summary>
        /// This gets edited in advanced mode
        /// </summary>
        public string CaptchaErrorMessage
        
 
            get
            
                return _captchaErrorMessage;
            
            set
            
                _captchaErrorMessage = value;
            
        
        #endregion
    

Posted by Community Admin on 01-Aug-2013 00:00

I agree with Steve.
Instead of a checkbox, it should be a widget to be dragged and dropped into the form, like any other form widgets.
The form may have a complex layout, and this flexibility would simplify positioning Captcha widget.

Posted by Community Admin on 01-Aug-2013 00:00

If captcha is delivered as a form widget, the settings should be defined in widget settings as per form; not globally in Basic/Advanced settings pages.

Also I would like to see an option for reCAPTCHA. It is often asked for by our clients: www.google.com/recaptcha

Posted by Community Admin on 02-Aug-2013 00:00

Hi Steve and Osman,
Since you both find having a widget in Forms more convenient, we will apply this approach.
To summarize: the Captcha widget can be dropped to a Form. It will have a Widget Designer allowing the user to set it's behavior, similar to the Settings section  on the RadCaptcha Demo

As to reCaptcha  - we will provide a documentation or sample on how to add it to forms.

Thanks again for your feedback,
Kalina

Posted by Community Admin on 05-Aug-2013 00:00

Dear Kalina

On think I would defenitely like to see is the possibility to set characters.

I usually remove the following letters and numbers (zero, captial O, small cap letter L, capitel letter I) since I hate it when I get a captcha and never know if its an zero or an O or a capital i or small L)

Markus

Posted by Community Admin on 05-Aug-2013 00:00

Hi Markus,
Editing the character set will be possible in Widget Advanced Edit mode. All properties of RadCaptcha will be displayed for editing there.
Best,
- Kalina

Posted by Community Admin on 08-Aug-2013 00:00

Kali, since you've saved time not implimenting the checkbox....can we maybe get frond-end subscribe, subscription list, or permissions?

plus.google.com/.../gyC5vhSHaNV

Posted by Community Admin on 08-Aug-2013 00:00

Hi Steve,
We saved time from a checkbox but will invest in a Captcha widget designer instead :)
Anyway, since your request is not directly related to Captcha in Forms, i posted a reply here:
plus.google.com/.../gyC5vhSHaNV

Best,
Kalina


This thread is closed