Fix a huge security issue: sign users out when they change nickname

This commit is contained in:
jesopo 2018-09-04 09:59:18 +01:00
parent 345bc18366
commit be39669580

View file

@ -7,10 +7,11 @@ REQUIRES_IDENTIFY = ("You need to be identified to use that command "
class Module(object):
def __init__(self, bot, events, exports):
self.bot = bot
events.on("new").on("user").hook(self.new_user)
events.on("preprocess").on("command").hook(
events.on("new.user").hook(self.new_user)
events.on("preprocess.command").hook(
self.preprocess_command)
events.on("received").on("part").hook(self.on_part)
events.on("received.part").hook(self.on_part)
events.on("received.nick").hook(self.on_nick)
events.on("received").on("command").on("identify"
).hook(self.identify, private_only=True, min_args=1,
@ -40,6 +41,12 @@ class Module(object):
event["user"].send_notice("You no longer share any channels "
"with me so you have been signed out")
def on_nick(self, event):
if event["user"].identified:
self._logout(event["user"])
event["user"].send_notice("You've changed nickname so you "
"have been signed out")
def _get_hash(self, user):
hash, salt = user.get_setting("authentication", (None, None))
return hash, salt