From 77e8ef4c1607591f12512e657173791dcbf38e1d Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Wed, 28 Oct 2020 22:48:27 +0000 Subject: [PATCH] Implement authentication checking on connection --- conf/example/irc.json | 7 +++++-- modules/regproc.py | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/conf/example/irc.json b/conf/example/irc.json index 680eb58..d2f6bb7 100644 --- a/conf/example/irc.json +++ b/conf/example/irc.json @@ -2,12 +2,15 @@ "_": { "register": true, "entity": "NickServ", - "email": "{nickname}.irc@domain.com", + "email": "{nickname}@domain.com", "register": "REGISTER {password} {email}", "confirm": "CONFIRM {token}", "check": true, + "ping": true, + "pingmsg": "STATUS {nickname}", "checktype": "mode", "checkmode": "r", - "checkmsg": "Password accepted - you are now recognized." + "checkmsg": "Password accepted - you are now recognized.", + "checkmsg2": "You are logged in as" } } diff --git a/modules/regproc.py b/modules/regproc.py index b9c3aa0..4ad63a4 100644 --- a/modules/regproc.py +++ b/modules/regproc.py @@ -81,9 +81,14 @@ def registerTest(c): inst = selectInst(c["net"]) if inst["check"] == False: return - if inst["checktype"] == "msg": - if c["type"] == "query": - if inst["checkmsg"] in c["msg"] and c["nick"] == inst["entity"]: + if "msg" in c.keys(): + if inst["checktype"] == "msg": + if c["type"] == "query": + if inst["checkmsg"] in c["msg"] and c["nick"] == inst["entity"]: + confirmRegistration(c["net"], c["num"]) + return + if inst["ping"]: + if inst["checkmsg2"] in c["msg"] and c["nick"] == inst["entity"]: confirmRegistration(c["net"], c["num"]) return elif inst["checktype"] == "mode":