From bd3889b6ec4d9254ec5608a8db242fec1d310096 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 27 Oct 2010 00:50:17 +0200 Subject: [PATCH] Include a Required xml element in the captcha field --- src/ejabberd_captcha.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl index 9394342a0..cd6a1b897 100644 --- a/src/ejabberd_captcha.erl +++ b/src/ejabberd_captcha.erl @@ -92,7 +92,8 @@ create_captcha(Id, SID, From, To, Lang, Args) ?VFIELD("hidden", "challenge", {xmlcdata, Id}), ?VFIELD("hidden", "sid", {xmlcdata, SID}), {xmlelement, "field", [{"var", "ocr"}, {"label", ?CAPTCHA_TEXT(Lang)}], - [{xmlelement, "media", [{"xmlns", ?NS_MEDIA}], + [{xmlelement, "required", [], []}, + {xmlelement, "media", [{"xmlns", ?NS_MEDIA}], [{xmlelement, "uri", [{"type", Type}], [{xmlcdata, "cid:" ++ CID}]}]}]}]}]}, BodyString1 = translate:translate(Lang, "Your messages to ~s are being blocked. To unblock them, visit ~s"), @@ -147,7 +148,8 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) -> ?VFIELD("hidden", "challenge", {xmlcdata, Id}), ?VFIELD("hidden", "sid", {xmlcdata, SID}), {xmlelement, "field", [{"var", "ocr"}, {"label", ?CAPTCHA_TEXT(Lang)}], - [{xmlelement, "media", [{"xmlns", ?NS_MEDIA}], + [{xmlelement, "required", [], []}, + {xmlelement, "media", [{"xmlns", ?NS_MEDIA}], [{xmlelement, "uri", [{"type", Type}], [{xmlcdata, "cid:" ++ CID}]}]}]}] ++ TailEls}, Tref = erlang:send_after(?CAPTCHA_LIFETIME, ?MODULE, {remove_id, Id}),