mod_register: Allow for account-removal-only setup

Since commit de91618070, it was no longer
possible to configure mod_register so that only account removal (i.e.,
no registration) is permitted.  Revert to the previous behavior which
allows admins to freely configure account registration and removal via
separate access rules.
This commit is contained in:
Holger Weiss 2020-09-29 06:11:30 +02:00
parent d9cb6d1af7
commit df58ee924f
1 changed files with 10 additions and 11 deletions

View File

@ -114,13 +114,12 @@ process_iq(#iq{from = From, to = To} = IQ, Source) ->
end,
Server = To#jid.lserver,
Access = mod_register_opt:access_remove(Server),
Remove = case acl:match_rule(Server, Access, From) of
deny -> deny;
allow when From#jid.lserver /= Server ->
deny;
allow ->
check_access(From#jid.luser, Server, Source)
end,
Remove = case {acl:match_rule(Server, Access, From), From#jid.lserver} of
{allow, Server} ->
allow;
{_, _} ->
deny
end,
process_iq(IQ, Source, IsCaptchaEnabled, Remove == allow).
process_iq(#iq{type = set, lang = Lang,
@ -636,10 +635,10 @@ mod_doc() ->
[{access,
#{value => ?T("AccessName"),
desc =>
?T("Specify rules to restrict what usernames can be registered and "
"unregistered. If a rule returns 'deny' on the requested username, "
"registration and unregistration of that user name is denied. "
"There are no restrictions by default.")}},
?T("Specify rules to restrict what usernames can be registered. "
"If a rule returns 'deny' on the requested username, "
"registration of that user name is denied. There are no "
"restrictions by default.")}},
{access_from,
#{value => ?T("AccessName"),
desc =>