Example #1
0
def splash_action(request):
	if not request.POST.has_key('accept'):
		return HttpResponseForbidden('Not authorized')

	# user accepted
	client_ip = request.META['REMOTE_ADDR']
	try:
		c = ArpCache()
		client_mac = c.get_mac(client_ip)
	except KeyError:
		client_mac=''

	auth = DeviceAuthorization(ip_address=client_ip, mac_address=client_mac)
	auth.save()

	fw = Firewall()
	fw.add_authorization(auth)

	context = {'device_authorization': auth}

	return render(request, 'captive_portal/splash_action.html', context)