portail_captif: lien spécial pour register une mac
This commit is contained in:
parent
112f43046c
commit
2893473d6e
1 changed files with 21 additions and 0 deletions
|
@ -135,6 +135,25 @@ def get_page(ip, by_mac=False, accueil=False):
|
|||
return deco['inscrit']
|
||||
return None
|
||||
|
||||
def special(action, ip, environ, start_response):
|
||||
mac = mac_from_ip(ip)
|
||||
url = "https://intranet2.crans.org/machines/add/"
|
||||
if 'wifi' in action:
|
||||
url += 'wifi/'
|
||||
else:
|
||||
url += 'fil/'
|
||||
if mac is not None:
|
||||
url += mac + '/'
|
||||
start_response("302 OK", [
|
||||
("Content-Type", "text/html"),
|
||||
("Cache-Control", "no-cache, must-revalidate"),
|
||||
("Expires", "Thu, 01 Jan 1970 00:00:00 GMT"),
|
||||
("Location", url),
|
||||
("Content-Length", 0)
|
||||
])
|
||||
return ""
|
||||
|
||||
|
||||
def app(environ, start_response):
|
||||
if 'HTTP_K_REAL_IP' in environ.keys():
|
||||
ip=environ['HTTP_K_REAL_IP']
|
||||
|
@ -142,6 +161,8 @@ def app(environ, start_response):
|
|||
ip=environ['HTTP_REAL_IP']
|
||||
now=time.time()
|
||||
cleanup(now)
|
||||
if environ.get('RAW_URI', '').startswith('/special'):
|
||||
return special(environ.get('RAW_URI','')[9:], ip, environ, start_response)
|
||||
if AddrInNet(ip, '10.231.137.0/24'):
|
||||
if environ.get('RAW_URI', '').startswith('/enable'):
|
||||
enable_access(ip)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue