24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-26 22:35:31 +02:00

When checking captcha setup, try to generate image only when captcha is enabled in order to avoid logging of confusing error

This commit is contained in:
Evgeniy Khramtsov 2011-05-18 12:48:02 +10:00
parent f7d532f2f7
commit 7bc879c6f4

View File

@ -559,15 +559,16 @@ is_feature_available() ->
end. end.
check_captcha_setup() -> check_captcha_setup() ->
AbleToGenerateCaptcha = case create_image() of case is_feature_available() of
{ok, _, _, _} -> true;
_Error -> false
end,
case is_feature_available() andalso not AbleToGenerateCaptcha of
true -> true ->
?CRITICAL_MSG("Captcha is enabled in the option captcha_cmd, " case create_image() of
"but it can't generate images.", []), {ok, _, _, _} ->
throw({error, captcha_cmd_enabled_but_fails}); ok;
_Err ->
?CRITICAL_MSG("Captcha is enabled in the option captcha_cmd, "
"but it can't generate images.", []),
throw({error, captcha_cmd_enabled_but_fails})
end;
false -> false ->
ok ok
end. end.