Implement API endpoint to enable authentication
This commit is contained in:
parent
5db659b9af
commit
047e9148aa
13
api/views.py
13
api/views.py
|
@ -593,3 +593,16 @@ class API(object):
|
||||||
if token:
|
if token:
|
||||||
regproc.confirmAccount(net, num, token)
|
regproc.confirmAccount(net, num, token)
|
||||||
return dumps({"success": True})
|
return dumps({"success": True})
|
||||||
|
|
||||||
|
@app.route("/irc/network/<net>/<num>/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})
|
||||||
|
|
Loading…
Reference in New Issue