mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 17:29:21 +01:00
Allow specifying login blocks that are local to certain networks
(cherry picked from commit 8059f3f7fc
)
This commit is contained in:
parent
1fbe3c6891
commit
c5970ba26d
@ -15,6 +15,15 @@ from pylinkirc.log import log
|
|||||||
|
|
||||||
def _login(irc, source, username):
|
def _login(irc, source, username):
|
||||||
"""Internal function to process logins."""
|
"""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.users[source].account = username
|
||||||
irc.reply('Successfully logged in as %s.' % username)
|
irc.reply('Successfully logged in as %s.' % username)
|
||||||
log.info("(%s) Successful login to %r by %s",
|
log.info("(%s) Successful login to %r by %s",
|
||||||
|
@ -92,6 +92,9 @@ login:
|
|||||||
# (plain text) for backwards compatibility.
|
# (plain text) for backwards compatibility.
|
||||||
encrypted: true
|
encrypted: true
|
||||||
|
|
||||||
|
# Optional: allows limiting this login to users from certain networks only (case sensitive).
|
||||||
|
#networks: ["network1", "network2"]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
# Permissions are described in more detail in example-permissions.yml, if you want to
|
# Permissions are described in more detail in example-permissions.yml, if you want to
|
||||||
# customize permissions further.
|
# customize permissions further.
|
||||||
|
Loading…
Reference in New Issue
Block a user