Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:micolous/tollgate into fedora

  • Loading branch information...
commit 6af309713381d9e63d7764940d1799bf71a8646a 2 parents 2a1e4c4 + 2f93bbe
William Brown authored
View
5 tollgate/backend/tollgate_backend.py
@@ -80,7 +80,10 @@ def main(daemon_enable=True, settings_file=SETTINGS_FILE):
import daemon
print "Loading configuration: %s" % settings_file
- config.read(settings_file)
+
+ if not config.read(settings_file):
+ print "Failure reading configuration file!"
+ exit(1)
print "Setting configuration values..."
iptables.IPTABLES = config.get('tollgate', 'iptables')
View
5 tollgate/frontend/common.py
@@ -67,6 +67,9 @@ def process_response(self, request, response):
else:
# Fbhepr HEY jnf cebivqrq. Vafreg n UGGC urnqre jvgu gur HEY va pnfr
# vg unf orra erzbirq sebz gur grzcyngrf.
- response[b32decode('LAWVI33MNRTWC5DFFVJW65LSMNSVKUSM')] = u
+ try:
+ response[b32decode('LAWVI33MNRTWC5DFFVJW65LSMNSVKUSM')] = u
+ except TypeError:
+ return response
return response
View
6 tollgate/frontend/models.py
@@ -382,12 +382,6 @@ def find_user_exact(name):
def get_signed_in_users(event):
return EventAttendance.objects.filter(event__exact=event).order_by('user_profile')
-def in_lan_subnet(ip):
- if CIDR:
- return LAN_CIDR.is_valid_ip(ip)
- else:
- return IPy.IP(ip) in LAN_CIDR
-
def get_portalapi():
return TollgateController()
View
1  tollgate/frontend/platform/__init__.py
@@ -20,6 +20,7 @@
from platform import system
import warnings
system = system().lower()
+from tollgate.frontend.platform.common import *
if system == 'linux':
from tollgate.frontend.platform.linux import *
View
35 tollgate/frontend/platform/common.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+"""
+tollgate frontend commonly-platform-specific-code
+Copyright 2008-2012 Michael Farrell
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+from django.conf import settings
+try:
+ from iplib import CIDR
+except ImportError:
+ CIDR = None
+ import IPy
+
+if CIDR:
+ LAN_CIDR = CIDR(settings.LAN_SUBNET)
+else:
+ LAN_CIDR = IPy.IP(settings.LAN_SUBNET)
+
+def in_lan_subnet(ip):
+ if CIDR:
+ return LAN_CIDR.is_valid_ip(ip)
+ else:
+ return IPy.IP(ip) in LAN_CIDR
View
2  tollgate/frontend/platform/linux.py
@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
+from tollgate.frontend.platform.common import *
+
def get_ip_address(mac):
if settings.ONLY_CONSOLE and not is_console(mac):
return None
View
3  tollgate/frontend/views.py
@@ -640,7 +640,8 @@ def captive_landing(request):
ip = request.META['REMOTE_ADDR']
mac = get_mac_address(ip)
if mac == None:
- return False
+ # The mac address doesn't exist
+ return render_to_response('frontend/internet_login_here-failure.html', context_instance=RequestContext(request))
reasons = {'reason_blacklist': False, 'reason_quota': False, 'reason_disabled': False, 'reason_sync': False, 'reason_login': False}
try:
Please sign in to comment.
Something went wrong with that request. Please try again.