mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
Allow specifying login blocks that are local to certain networks
This commit is contained in:
parent
21a39de0b4
commit
8059f3f7fc
@ -15,6 +15,15 @@ from pylinkirc.log import log
|
||||
|
||||
def _login(irc, source, username):
|
||||
"""Internal function to process logins."""
|
||||
|
||||
logindata = conf.conf['login'].get('accounts', {}).get(username, {})
|
||||
network_filter = logindata.get('networks')
|
||||
|
||||
if network_filter and irc.name not in network_filter:
|
||||
irc.error("You are not authorized to log in to %r on this network." % username)
|
||||
log.warning("(%s) Failed login to %r from %s (wrong network: networks filter says %r but we got %r)", irc.name, username, irc.get_hostmask(source), ', '.join(network_filter), irc.name)
|
||||
return
|
||||
|
||||
irc.users[source].account = username
|
||||
irc.reply('Successfully logged in as %s.' % username)
|
||||
log.info("(%s) Successful login to %r by %s",
|
||||
|
@ -92,6 +92,9 @@ login:
|
||||
# (plain text) for backwards compatibility.
|
||||
encrypted: true
|
||||
|
||||
# Optional: allows limiting this login to users from certain networks only (case sensitive).
|
||||
#networks: ["network1", "network2"]
|
||||
|
||||
permissions:
|
||||
# Permissions are described in more detail in example-permissions.yml, if you want to
|
||||
# customize permissions further.
|
||||
|
Loading…
Reference in New Issue
Block a user