Implement API call to register

This commit is contained in:
Mark Veidemanis 2022-08-14 16:26:09 +01:00
parent e30250603b
commit b62200d410
3 changed files with 8 additions and 7 deletions

View File

@ -244,6 +244,9 @@ class API(object):
for conn in conns:
conn.authenticated = False
conn.regPing()
elif func == "register":
for conn in conns:
regproc.registerAccount(conn.net, conn.num)
return dumps({"success": True})
@app.route("/irc/network/<net>/", methods=["DELETE"])

View File

@ -6,9 +6,7 @@ from utils.deliver_relay_commands import deliverRelayCommands
from utils.logging.log import warn
def provisionUserNetworkData(
num, nick, altnick, ident, realname, network, host, port, security
):
def provisionUserNetworkData(num, nick, altnick, ident, realname, network, host, port, security):
commands = {}
stage2commands = {}
stage2commands["status"] = []

View File

@ -2,7 +2,7 @@ from copy import deepcopy
from random import choice
import main
from modules import provision, helpers
from modules import provision
from utils.logging.debug import debug
from utils.logging.log import error
@ -89,6 +89,7 @@ def registerAccount(net, num):
error("Cannot register for %s: function disabled" % (net))
return False
name = net + str(num)
if not main.IRCPool[name].authenticated:
main.IRCPool[name].msg(sinst["entity"], sinst["registermsg"])
@ -123,15 +124,14 @@ def confirmRegistration(net, num, negativepass=None):
def attemptManualAuthentication(net, num):
sinst = substitute(net, num)
obj = main.network[net]
identifymsg = sinst["identifymsg"]
entity = sinst["entity"]
name = f"{net}{num}"
print(f"SENDING `{identifymsg}` TO `{entity}` ON {name}")
if name not in main.IRCPool:
return
main.IRCPool[name].msg(entity, identifymsg)
def enableAuthentication(net, num, jump=True, run_now=False):
obj = main.network[net]
nick = main.alias[num]["nick"]