aboutsummaryrefslogtreecommitdiff
path: root/src/mod_register_web.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2018-08-02 18:36:41 +0200
committerBadlop <badlop@process-one.net>2018-08-02 18:36:41 +0200
commitc9ba0e83d28866f3b2cd47291b3e403e3ad2eadc (patch)
tree3d48574bdb2290f27cee1ecb940cf071f69449d2 /src/mod_register_web.erl
parentMerge pull request #2551 from MarcelWaldvogel/configurable-extauth-pool (diff)
Handle ejabberd_captcha error reports in mod_register_web (#2553)
Diffstat (limited to 'src/mod_register_web.erl')
-rw-r--r--src/mod_register_web.erl13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mod_register_web.erl b/src/mod_register_web.erl
index 7bda0e67d..ae659ddc8 100644
--- a/src/mod_register_web.erl
+++ b/src/mod_register_web.erl
@@ -222,7 +222,16 @@ index_page(Lang) ->
%%%----------------------------------------------------------------------
form_new_get(Host, Lang, IP) ->
- CaptchaEls = build_captcha_li_list(Lang, IP),
+ try build_captcha_li_list(Lang, IP) of
+ CaptchaEls ->
+ form_new_get2(Host, Lang, CaptchaEls)
+ catch
+ throw:Result ->
+ ?DEBUG("Unexpected result when creating a captcha: ~p", [Result]),
+ ejabberd_web:error(not_allowed)
+ end.
+
+form_new_get2(Host, Lang, CaptchaEls) ->
HeadEls = [meta(),
?XCT(<<"title">>,
<<"Register a Jabber account">>),
@@ -360,7 +369,7 @@ build_captcha_li_list2(Lang, IP) ->
ejabberd_captcha:build_captcha_html(Id, Lang),
[?XE(<<"li">>,
[CText, ?C(<<" ">>), CId, CKey, ?BR, CImg])];
- _ -> []
+ Error -> throw(Error)
end.
%%%----------------------------------------------------------------------