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

Forums / Developing with Sitefinity / 6.3.5024 captcha custom char set

6.3.5024 captcha custom char set

10 posts, 0 answered
  1. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    08 Apr 2014
    Link to this post

    It seems I am blind again.

     I want to set the characters to be used in the captcha of my for myself. I dont like it when i have 0 O l I (one is an captital i the other a lowercase L)

     But I simply cant find it were to set. I went into edit - advaced - captcha but cant find it.

     Any one can help me? I guess I simply overlook it somehow.

     http://demos.telerik.com/aspnet-ajax/captcha/examples/characterset/defaultcs.aspx

    Markus

     

  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    11 Apr 2014
    Link to this post
    Hello,

    You need to create a new Form Captcha control which inherit from the default FormCaptcha. Then you need to change the captcha image char set and register the control.

    Custom For Captcha:
    public class CustomFormCaptcha : FormCaptcha
        {
            public string CharSet { get; set; }
     
            protected override string ScriptDescriptorTypeName
            {
                get
                {
                    return typeof(FormCaptcha).FullName;
                }
            }
     
            protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
            {
                base.InitializeControls(container);
                if (!string.IsNullOrEmpty(this.CharSet))
                {
                    this.Captcha.CaptchaImage.TextChars = CaptchaPossibleChars.CustomCharSet;
                    this.Captcha.CaptchaImage.CharSet = this.CharSet;
                }
                else
                {
                    this.Captcha.CaptchaImage.TextChars = CaptchaPossibleChars.LettersAndNumbers;
                }
            }
        }

    To register your control follow the steps in our Sitefinity documentation.

    I have added a feature request for you in our Feedback portal. You could review its description in our Feedback portal on the following link.

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    11 Apr 2014 in reply to Stefani Tacheva
    Link to this post

    Could you open up another feature request (more like a bug)

    The captcha is not localizable. Neither by Administration- Label & Messages nor by setting the text in advanced mode. So for now it seems I am stuck with english captchas on all my pages.

    I wonder why default RadControls stuff is not exposed.

    Markus

  4. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    15 Apr 2014 in reply to Markus
    Link to this post

    Support opened a feedback entry for this.

     Anyone using multilingual sites and forms captchas and feels like voting?

    http://feedback.telerik.com/Project/153/Feedback/Details/125592-form-captcha-control-localizable

    Strange enough the captcha on comments is localized :-(

     Markus

  5. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    15 Apr 2014
    Link to this post
    Hi,

    As you mentioned we have opened a feature request about this missing functionality which description could be found in our Feedback portal on the following link. However you could achieve the desired functionality using some customizations. I am sharing our solution with the community as well:

    You can apply the approaches described in the following articles:

    https://demos.telerik.com/aspnet-ajax/captcha/examples/localization/defaultcs.aspx

    http://www.telerik.com/help/aspnet-ajax/captcha-localization.html

    Here is a sample on how you can plug in your logic and alter the text:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Modules.Forms.Web.UI.Fields;
      
    namespace SitefinityWebApp
    {
        public class CustomFormsCaptcha : FormCaptcha
        {
            protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
            {
                this.Captcha.CaptchaLinkButtonText = "This is the custom link";
                this.Captcha.CaptchaTextBoxLabel = "This is custom label";
      
                base.InitializeControls(container);
            }
        }
    }

    Then you need to register your control as described in our Sitefinity documentation.

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  6. Dejan
    Dejan avatar
    8 posts
    Registered:
    14 Dec 2011
    02 Jun 2014
    Link to this post

    Hi,

    I tried to add this code you posted above but I get Uncaught ReferenceError. See attached file.

    Regards,
    Dejan Pecnik

  7. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    03 Jun 2014
    Link to this post
    Hello,

    It seems that your project name is different. Please create a new class calledCustomFormsCaptcha in your project and include the following code inside it:

    protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
            {
                this.Captcha.CaptchaLinkButtonText = "This is the custom link";
                this.Captcha.CaptchaTextBoxLabel = "This is custom label";
       
                base.InitializeControls(container);
            }

    Build your project and register the control. To register it follow the steps in our Sitefinity documentation.

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  8. Dejan
    Dejan avatar
    8 posts
    Registered:
    14 Dec 2011
    04 Jun 2014 in reply to Stefani Tacheva
    Link to this post

    Hello,

    I tried to create a new class but there is no difference. I can add control in the backend and it looks like it works well, but when I publish form and reopen it an error occurs.

    Regards,
    Dejan Pecnik

  9. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    08 Dec 2016
    16 Jun 2014
    Link to this post
    Hello Dejan,

    You should add the ScriptDescriptorType of the control to the FormCaptcha, so all other resources will be loaded from it:
    protected override string ScriptDescriptorType
          {
              get
              {
                 return typeof(FormCaptcha).FullName;
              }
          }

    I attach a sample custom RadCaptcha for sake of future simplicity. Here is a image reference on how to register in the FormControls section.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  10. Dejan
    Dejan avatar
    8 posts
    Registered:
    14 Dec 2011
    17 Jun 2014 in reply to Nikola Zagorchev
    Link to this post

    Thanks Nikola. This is solved my problem.

    Regars,
    Dejan Pecnik

10 posts, 0 answered