Implement button to enable authentication for relay
This commit is contained in:
@@ -158,6 +158,31 @@ class ThresholdIRCNetworkRelayProvision(SuperUserRequiredMixin, APIView):
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class ThresholdIRCNetworkRelayAuth(SuperUserRequiredMixin, APIView):
|
||||
template_name = "manage/threshold/irc/network/relays.html"
|
||||
|
||||
def post(self, request, net, num):
|
||||
"""
|
||||
Provision a relay
|
||||
"""
|
||||
provisioned = threshold.irc_enable_auth(net, num)
|
||||
if provisioned["success"]:
|
||||
|
||||
message = f"Enabled authentication on relay {num}"
|
||||
message_class = "success"
|
||||
else:
|
||||
message = provisioned["reason"]
|
||||
message_class = "danger"
|
||||
relays = threshold.get_irc_relays(net)
|
||||
context = {
|
||||
"net": net,
|
||||
"message": message,
|
||||
"class": message_class,
|
||||
"relays": relays["relays"],
|
||||
}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class ThresholdIRCNetworkRelayStatus(SuperUserRequiredMixin, APIView):
|
||||
template_name = "manage/threshold/irc/network/relays.html"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user