From 2d8bfb1a15ece1d8f02c4bae499a4ff1da08051c Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Mon, 25 Oct 2010 23:36:31 +1000 Subject: [PATCH] Provide image url in registration form when captcha is enabled --- src/ejabberd_captcha.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index 007439e26..38675ac58 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -239,6 +239,10 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) -> } ], children = [#xmlcdata{cdata = B64Image}]}, + HelpTxt = io_lib:format( + translate:translate( + Lang, "Visit ~s if you don't see the image"), + [get_url(Id ++ "/image")]), Captcha = #xmlel{name = 'x', ns = ?NS_DATA_FORMS_s, @@ -249,6 +253,8 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) -> ], children = [ ?VFIELD(<<"hidden">>, <<"FORM_TYPE">>, #xmlcdata{cdata = ?NS_CAPTCHA_b}) | HeadEls] ++ [ + #xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = + [?XMLATTR('type', <<"fixed">>), ?XMLATTR('label', HelpTxt)]}, ?VFIELD(<<"hidden">>, <<"from">>, #xmlcdata{cdata = exmpp_jid:to_binary(To)}), ?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}), ?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),