+1-888-365-2779
Try Now
More in this section

Forums / Upcoming Features / Sitefinity 6.2 Captcha for Forms

Sitefinity 6.2 Captcha for Forms

9 posts, 0 answered
  1. Kali
    Kali avatar
    158 posts
    Registered:
    25 Feb 2009
    01 Aug 2013
    Link to this post

    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

  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    01 Aug 2013 in reply to Kali
    Link to this post
    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
        }
    }

  3. Osman
    Osman avatar
    22 posts
    Registered:
    04 Oct 2010
    01 Aug 2013
    Link to this post
    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.
  4. Osman
    Osman avatar
    22 posts
    Registered:
    04 Oct 2010
    01 Aug 2013
    Link to this post
    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: http://www.google.com/recaptcha
  5. Kali
    Kali avatar
    158 posts
    Registered:
    25 Feb 2009
    02 Aug 2013
    Link to this post
    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
  6. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    05 Aug 2013 in reply to Kali
    Link to this post
    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
  7. Kali
    Kali avatar
    158 posts
    Registered:
    25 Feb 2009
    05 Aug 2013
    Link to this post
    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
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    08 Aug 2013
    Link to this post
    Kali, since you've saved time not implimenting the checkbox....can we maybe get frond-end subscribe, subscription list, or permissions?

    https://plus.google.com/105924849940590264025/posts/gyC5vhSHaNV
  9. Kali
    Kali avatar
    158 posts
    Registered:
    25 Feb 2009
    08 Aug 2013 in reply to Steve
    Link to this post
    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:
    https://plus.google.com/105924849940590264025/posts/gyC5vhSHaNV

    Best,
    Kalina


9 posts, 0 answered