Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jan 08, 2013 @ 13:07
    Jesper Ordrup
    0

    configuration

    Is it possible to configure font color?

    Thanks for sharing!

    Jesper

  • Luke Alderton 192 posts 509 karma points
    Jan 08, 2013 @ 13:10
    Luke Alderton
    1

    Hi Jesper,

    Not as yet, I will add that to the configuration for you later this evening.

    Thanks,
    Luke 

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jan 08, 2013 @ 13:13
    Jesper Ordrup
    0

    Thx :-)

     

  • Luke Alderton 192 posts 509 karma points
    Jan 10, 2013 @ 00:04
    Luke Alderton
    0

    Sorry for the long delay, I've uploaded the new version and it's ready for download, you can change the font color in the uCaptcha config file using RGB values! :)

  • Hema 2 posts 22 karma points
    Mar 20, 2013 @ 06:27
    Hema
    0

    How can we call and validate uCaptcha in uBlogsy submit comments?

    Thanks,

    Hema

  • Luke Alderton 192 posts 509 karma points
    Mar 20, 2013 @ 10:46
    Luke Alderton
    0

    Hi Hema,

    First of all, you need to make sure you have an image to use as your captcha bg located at '/images/captcha_bg.png' alternatively you can change the location and name of the background image using the configuration file stored in '/config/uCaptcha.config'.

    Once set up and configured, you can call the captcha by visiting 'http://yourwebsiteaddress/uCaptcha.ashx' this will return an image, so to display it on a web page reference it like any other image '<img src="/uCaptcha.ashx" width="150" height="40" alt="Captcha" />'.

    You can find out the value of the captcha programaticaly by loading the session variable named 'captchaString' you can access it using this: 'HttpContext.Current.Session["captchaString"]'

    In terms of adding it into uBlogsy, I'm not sure as I didn't create uBlogsy but I'd guess you'd download the uBlogsy source code from here: http://our.umbraco.org/projects/starter-kits/ublogsy and then navigate to the class file for the uBlogsy usercontrol named 'Contact', I think you'd then need to add a captcha check in the 'btnSubmit_Click' function; to do this, you'd need to create a text input field in the ashx for the user to input what they think the captcha reads and load the captcha image there too.You can then compare the value of the text input field with the value of the session variable set up by the captcha in the 'btnSubmit_Click' function to decide if the comment should be posted or not.

    Example of what should be added to the 'Contact.ashx' file:

    <asp:TextBox ID="txtCaptcha" runat="server"></asp:TextBox>
    <img src="/uCaptcha.ashx" width="150" height="40" alt="Captcha" />

    Example of what should be added to the 'Contact.ascx.cs' file:

    #region btnSubmit_Click

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
       if (m_NodeTypeAlias == "uBlogsyPost")
       {
           if (HttpContext.Current.Session["captchaString"] == txtCaptcha.Text)
           {
               CreateComment();
           }
       }
       else
       {
           SendEmail();
       }

        // redirect to current page to ensure razor macro is refreshed
       Response.Redirect(Request.Url.AbsolutePath.ToString() + "?success=true");
    }

    #endregion

     

    Again this is just a quick guess by looking at the source code myself.

  • Hema 2 posts 22 karma points
    Mar 20, 2013 @ 13:30
    Hema
    0

    Thanks Luke, Your response is very quickely and useful.

  • Shafiq 12 posts 62 karma points
    Jan 24, 2014 @ 05:26
    Shafiq
    0

    Hi Luke,

    Thanks for your fantastic work. It really helped me to implement captcha in my umbraco project. Just a friendly request to write your above instructions in the documentation pdf file. Like me many of us may be confused how to implement step by step.

    Thanks

    Shafiq

  • Antra 1 post 21 karma points
    Feb 05, 2014 @ 09:10
    Antra
    0

    Hello,
    I'm new on umbraco, and not a good developper. but this captcha is very interesting for us.
    I want to validate the captcha before submitting the page (and sending the e-mail) on the contact.ascx.
    I want that the validation will be like the e-mail textbox. 

    How to do it? How to insert the session, 'HttpContext.Current.Session["captchaString"]',  in the parameter ValidationExpression

    Regards,

    Antra

  • Manikandan 15 posts 96 karma points
    Oct 15, 2015 @ 07:00
    Manikandan
    0

    Hi, I am facing this problem while running the .ashx file can you please tell me how to fix this Error: "A Graphics object cannot be created from an image that has an indexed pixel format." [Exception: A Graphics object cannot be created from an image that has an indexed pixel format.] System.Drawing.Graphics.FromImage(Image image) +1620124 uCaptcha.Web.Handler.GenerateCaptcha(HttpContext context) +777 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

Please Sign in or register to post replies

Write your reply to:

Draft