monolith/legacy/commands/pass.py

26 lines
712 B
Python
Raw Normal View History

import main
2022-07-21 12:39:41 +00:00
class PassCommand:
def __init__(self, *args):
self.password(*args)
2022-09-05 06:20:30 +00:00
def password(
self, addr, authed, data, obj, spl, success, failure, info, incUsage, length
):
if authed:
info("You are already authenticated")
return
else:
if length == 2:
if spl[1] == main.config["Password"]:
success("Authenticated successfully")
obj.authed = True
return
else:
failure("Password incorrect")
obj.transport.loseConnection()
return
else:
incUsage("pass")