mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Introduce 'redirect_url' option for mod_register
The option enables registration redirection as described in https://xmpp.org/extensions/xep-0077.html#redirect Fixes #1976
This commit is contained in:
parent
68dee8cbb3
commit
7566d254e4
@ -210,7 +210,14 @@ process_iq(#iq{type = get, from = From, to = To, id = ID, lang = Lang} = IQ,
|
|||||||
Instr = translate:translate(
|
Instr = translate:translate(
|
||||||
Lang, <<"Choose a username and password to register "
|
Lang, <<"Choose a username and password to register "
|
||||||
"with this server">>),
|
"with this server">>),
|
||||||
if IsCaptchaEnabled and not IsRegistered ->
|
URL = gen_mod:get_module_opt(Server, ?MODULE, redirect_url, <<"">>),
|
||||||
|
if (URL /= <<"">>) and not IsRegistered ->
|
||||||
|
Txt = translate:translate(Lang, <<"To register, visit ~s">>),
|
||||||
|
Desc = str:format(Txt, [URL]),
|
||||||
|
xmpp:make_iq_result(
|
||||||
|
IQ, #register{instructions = Desc,
|
||||||
|
sub_els = [#oob_x{url = URL}]});
|
||||||
|
IsCaptchaEnabled and not IsRegistered ->
|
||||||
TopInstr = translate:translate(
|
TopInstr = translate:translate(
|
||||||
Lang, <<"You need a client that supports x:data "
|
Lang, <<"You need a client that supports x:data "
|
||||||
"and CAPTCHA to register">>),
|
"and CAPTCHA to register">>),
|
||||||
@ -614,9 +621,11 @@ mod_opt_type({welcome_message, subject}) ->
|
|||||||
fun iolist_to_binary/1;
|
fun iolist_to_binary/1;
|
||||||
mod_opt_type({welcome_message, body}) ->
|
mod_opt_type({welcome_message, body}) ->
|
||||||
fun iolist_to_binary/1;
|
fun iolist_to_binary/1;
|
||||||
|
mod_opt_type(redirect_url) ->
|
||||||
|
fun iolist_to_binary/1;
|
||||||
mod_opt_type(_) ->
|
mod_opt_type(_) ->
|
||||||
[access, access_from, access_remove, captcha_protected, ip_access,
|
[access, access_from, access_remove, captcha_protected, ip_access,
|
||||||
iqdisc, password_strength, registration_watchers,
|
iqdisc, password_strength, registration_watchers, redirect_url,
|
||||||
{welcome_message, subject}, {welcome_message, body}].
|
{welcome_message, subject}, {welcome_message, body}].
|
||||||
|
|
||||||
-spec opt_type(registration_timeout) -> fun((timeout()) -> timeout());
|
-spec opt_type(registration_timeout) -> fun((timeout()) -> timeout());
|
||||||
|
Loading…
Reference in New Issue
Block a user