25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Changes in registration form to workaround client problems (EJAB-1262)

Changes included:
* Remove var in fixed field because Gajim and Tkabber display it to user
* Add workaround for Psi's overlap fields
* Add var=url attribute, required by Psi to display the field
* Provide the image URL as a copy-able form field
This commit is contained in:
Badlop 2010-10-25 19:00:52 +02:00
parent 633b467a22
commit 82e8048a8a

View File

@ -239,10 +239,11 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
} }
], ],
children = [#xmlcdata{cdata = B64Image}]}, children = [#xmlcdata{cdata = B64Image}]},
HelpTxt = io_lib:format( HelpTxt = translate:translate(
translate:translate( Lang,
Lang, "Visit ~s if you don't see the image"), "If you don't see the CAPTCHA image here, "
[get_url(Id ++ "/image")]), "visit the web page."),
Imageurl = list_to_binary(get_url(Id ++ "/image")),
Captcha = Captcha =
#xmlel{name = 'x', #xmlel{name = 'x',
ns = ?NS_DATA_FORMS_s, ns = ?NS_DATA_FORMS_s,
@ -255,6 +256,25 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
?VFIELD(<<"hidden">>, <<"FORM_TYPE">>, #xmlcdata{cdata = ?NS_CAPTCHA_b}) | HeadEls] ++ [ ?VFIELD(<<"hidden">>, <<"FORM_TYPE">>, #xmlcdata{cdata = ?NS_CAPTCHA_b}) | HeadEls] ++ [
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs = #xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
[?XMLATTR('type', <<"fixed">>), ?XMLATTR('label', HelpTxt)]}, [?XMLATTR('type', <<"fixed">>), ?XMLATTR('label', HelpTxt)]},
?VFIELD(<<"hidden">>, <<"captchahidden">>, #xmlcdata{cdata = <<"workaround-for-psi">>}),
#xmlel{name = 'field',
attrs = [
#xmlattr{name = 'type',
value = <<"text-single">>
},
#xmlattr{name = 'label',
value = translate:translate(Lang, "CAPTCHA web page")
},
#xmlattr{name = 'var',
value = <<"url">>
}
],
children = [
#xmlel{name = 'value',
children = [#xmlcdata{cdata = Imageurl}]
}
]},
?VFIELD(<<"hidden">>, <<"from">>, #xmlcdata{cdata = exmpp_jid:to_binary(To)}), ?VFIELD(<<"hidden">>, <<"from">>, #xmlcdata{cdata = exmpp_jid:to_binary(To)}),
?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}), ?VFIELD(<<"hidden">>, <<"challenge">>, #xmlcdata{cdata = list_to_binary(Id)}),
?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}), ?VFIELD(<<"hidden">>, <<"sid">>, #xmlcdata{cdata = SID}),