mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Additional fixes for previous captcha commits related to exmpp
This commit is contained in:
parent
32868e534e
commit
48dcc5180a
@ -265,7 +265,7 @@ create_captcha_x(SID, To, Lang, HeadEls, TailEls) ->
|
|||||||
value = <<"text-single">>
|
value = <<"text-single">>
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'label',
|
#xmlattr{name = 'label',
|
||||||
value = translate:translate(Lang, "CAPTCHA web page")
|
value = list_to_binary(translate:translate(Lang, "CAPTCHA web page"))
|
||||||
},
|
},
|
||||||
#xmlattr{name = 'var',
|
#xmlattr{name = 'var',
|
||||||
value = <<"url">>
|
value = <<"url">>
|
||||||
@ -525,7 +525,7 @@ process(_Handlers, #request{method='POST', q=Q, lang=Lang, path=[_, Id]}) ->
|
|||||||
% }]},
|
% }]},
|
||||||
#xmlel{name = 'p',
|
#xmlel{name = 'p',
|
||||||
children = [
|
children = [
|
||||||
#xmlcdata{cdata = translate:translate(Lang, "The captcha is valid.")}
|
#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "The captcha is valid."))}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
ejabberd_web:make_xhtml([Form]);
|
ejabberd_web:make_xhtml([Form]);
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
|
|
||||||
-record(ejabberd_module, {module_host, opts}).
|
-record(ejabberd_module, {module_host, opts}).
|
||||||
|
%% module_host = {Module::atom(), Host::string()}
|
||||||
|
|
||||||
behaviour_info(callbacks) ->
|
behaviour_info(callbacks) ->
|
||||||
[{start, 2},
|
[{start, 2},
|
||||||
|
@ -96,7 +96,7 @@ process_iq(From, To,
|
|||||||
#iq{type = Type, lang = Lang, payload = SubEl, id = ID} = IQ_Rec,
|
#iq{type = Type, lang = Lang, payload = SubEl, id = ID} = IQ_Rec,
|
||||||
Source) ->
|
Source) ->
|
||||||
IsCaptchaEnabled = case gen_mod:get_module_opt(
|
IsCaptchaEnabled = case gen_mod:get_module_opt(
|
||||||
exmpp_jid:domain(To), ?MODULE, captcha_protected, false) of
|
exmpp_jid:domain_as_list(To), ?MODULE, captcha_protected, false) of
|
||||||
true ->
|
true ->
|
||||||
true;
|
true;
|
||||||
_ ->
|
_ ->
|
||||||
@ -504,7 +504,7 @@ write_time({{Y,Mo,D},{H,Mi,S}}) ->
|
|||||||
[Y, Mo, D, H, Mi, S]).
|
[Y, Mo, D, H, Mi, S]).
|
||||||
|
|
||||||
process_xdata_submit(El) ->
|
process_xdata_submit(El) ->
|
||||||
case xml:get_subtag(El, "x") of
|
case exmpp_xml:get_element(El, x) of
|
||||||
false ->
|
false ->
|
||||||
error;
|
error;
|
||||||
Xdata ->
|
Xdata ->
|
||||||
@ -519,7 +519,7 @@ process_xdata_submit(El) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
is_strong_password(Server, Password) ->
|
is_strong_password(Server, Password) ->
|
||||||
LServer = jlib:nameprep(Server),
|
LServer = exmpp_stringprep:nameprep(Server),
|
||||||
case gen_mod:get_module_opt(LServer, ?MODULE, password_strength, 0) of
|
case gen_mod:get_module_opt(LServer, ?MODULE, password_strength, 0) of
|
||||||
Entropy when is_number(Entropy), Entropy >= 0 ->
|
Entropy when is_number(Entropy), Entropy >= 0 ->
|
||||||
if Entropy == 0 ->
|
if Entropy == 0 ->
|
||||||
|
Loading…
Reference in New Issue
Block a user