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

Update FORM_TYPE from captcha to register (#3045)

This commit is contained in:
Badlop 2020-10-20 21:43:31 +02:00
parent 5318bf3743
commit 2946df357c

View File

@ -183,7 +183,12 @@ process_iq(#iq{type = set, to = To,
lang = Lang, sub_els = [#register{xdata = #xdata{} = X}]} = IQ, lang = Lang, sub_els = [#register{xdata = #xdata{} = X}]} = IQ,
Source, true, _AllowRemove) -> Source, true, _AllowRemove) ->
Server = To#jid.lserver, Server = To#jid.lserver,
case ejabberd_captcha:process_reply(X) of XdataC = xmpp_util:set_xdata_field(
#xdata_field{
var = <<"FORM_TYPE">>,
type = hidden, values = [?NS_CAPTCHA]},
X),
case ejabberd_captcha:process_reply(XdataC) of
ok -> ok ->
case process_xdata_submit(X) of case process_xdata_submit(X) of
{ok, User, Password} -> {ok, User, Password} ->
@ -242,9 +247,15 @@ process_iq(#iq{type = get, from = From, to = To, id = ID, lang = Lang} = IQ,
fields = [UField, PField]}, fields = [UField, PField]},
case ejabberd_captcha:create_captcha_x(ID, To, Lang, Source, X) of case ejabberd_captcha:create_captcha_x(ID, To, Lang, Source, X) of
{ok, CaptchaEls} -> {ok, CaptchaEls} ->
{value, XdataC, CaptchaEls2} = lists:keytake(xdata, 1, CaptchaEls),
Xdata = xmpp_util:set_xdata_field(
#xdata_field{
var = <<"FORM_TYPE">>,
type = hidden, values = [?NS_REGISTER]},
XdataC),
xmpp:make_iq_result( xmpp:make_iq_result(
IQ, #register{instructions = TopInstr, IQ, #register{instructions = TopInstr,
sub_els = CaptchaEls}); sub_els = [Xdata | CaptchaEls2]});
{error, limit} -> {error, limit} ->
ErrText = ?T("Too many CAPTCHA requests"), ErrText = ?T("Too many CAPTCHA requests"),
xmpp:make_error( xmpp:make_error(