Allow mod_register_web to be accessed from now-served vhosts (#3173)

This commit is contained in:
Badlop 2020-02-26 13:27:22 +01:00
parent 00abf5d42c
commit 47c5aba1e5
1 changed files with 11 additions and 22 deletions

View File

@ -93,31 +93,20 @@ process([], #request{method = 'GET', lang = Lang}) ->
process([<<"register.css">>], process([<<"register.css">>],
#request{method = 'GET'}) -> #request{method = 'GET'}) ->
serve_css(); serve_css();
process([<<"new">>], process([Section],
#request{method = 'GET', lang = Lang, host = Host, #request{method = 'GET', lang = Lang, host = Host,
ip = IP}) -> ip = {Addr, _Port}}) ->
case ejabberd_router:is_my_host(Host) of Host2 = case ejabberd_router:is_my_host(Host) of
true -> true ->
{Addr, _Port} = IP, Host;
form_new_get(Host, Lang, Addr);
false -> false ->
{400, [], <<"Host not served">>} <<"">>
end; end,
process([<<"delete">>], case Section of
#request{method = 'GET', lang = Lang, host = Host}) -> <<"new">> -> form_new_get(Host2, Lang, Addr);
case ejabberd_router:is_my_host(Host) of <<"delete">> -> form_del_get(Host2, Lang);
true -> <<"change_password">> -> form_changepass_get(Host2, Lang);
form_del_get(Host, Lang); _ -> {404, [], "Not Found"}
false ->
{400, [], <<"Host not served">>}
end;
process([<<"change_password">>],
#request{method = 'GET', lang = Lang, host = Host}) ->
case ejabberd_router:is_my_host(Host) of
true ->
form_changepass_get(Host, Lang);
false ->
{400, [], <<"Host not served">>}
end; end;
process([<<"new">>], process([<<"new">>],
#request{method = 'POST', q = Q, ip = {Ip, _Port}, #request{method = 'POST', q = Q, ip = {Ip, _Port},