diff --git a/api/views.py b/api/views.py index 35b17b6..c0a734c 100644 --- a/api/views.py +++ b/api/views.py @@ -593,3 +593,16 @@ class API(object): if token: regproc.confirmAccount(net, num, token) return dumps({"success": True}) + + @app.route("/irc/network///auth/", methods=["POST"]) + @login_required + def irc_enable_auth(self, request, net, num): + if net not in main.network.keys(): + return dumps({"success": False, "reason": "no such net."}) + if not num.isdigit(): + return dumps({"success": False, "reason": "invalid num: not a number."}) + num = int(num) + if num not in main.network[net].relays.keys(): + return dumps({"success": False, "reason": f"no relay {num} on {net}"}) + regproc.enableAuthentication(net, num) + return dumps({"success": True})