25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-13 15:16:49 +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.
check_captcha_setup() ->
AbleToGenerateCaptcha = case create_image() of
{ok, _, _, _} -> true;
_Error -> false
end,
case is_feature_available() andalso not AbleToGenerateCaptcha of
case is_feature_available() of
true ->
?CRITICAL_MSG("Captcha is enabled in the option captcha_cmd, "
"but it can't generate images.", []),
throw({error, captcha_cmd_enabled_but_fails});
case create_image() of
{ok, _, _, _} ->
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 ->
ok
end.