25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Merge pull request #156 from hamano/devel

mod_register_web: check same acl as mod_register.
This commit is contained in:
badlop 2014-04-07 12:39:22 +02:00
commit 2d441b3305

View File

@ -485,9 +485,15 @@ form_del_get(Host, Lang) ->
%% {error, not_allowed} |
%% {error, invalid_jid}
register_account(Username, Host, Password) ->
case jlib:make_jid(Username, Host, <<"">>) of
error -> {error, invalid_jid};
_ -> register_account2(Username, Host, Password)
Access = gen_mod:get_module_opt(Host, mod_register, access,
fun(A) when is_atom(A) -> A end,
all),
JID = jlib:make_jid(Username, Host, <<"">>),
Match = acl:match_rule(Host, Access, JID),
case {JID, Match} of
{error, _} -> {error, invalid_jid};
{_, deny} -> {error, not_allowed};
{_, allow} -> register_account2(Username, Host, Password)
end.
register_account2(Username, Host, Password) ->