5 import os, sys, string, time
11 import neo_cgi, neo_cs, neo_util
12 from MBPage
import MBPage
13 from webui
import config
15 from auth
import browserauth
16 from auth
import cookieauth
17 from auth
import db_auth
18 from auth
import pwauth
20 TAKEOVER_FILE = os.path.join(config.ROS_VAR_DIR,
"takeover.dat")
27 username = hdf.getValue(
"Query.username",
"")
28 if not username:
return 30 ip_address = socket.gethostbyname(config.gLobbyHost)
32 if hdf.getValue(
"CGI.RemoteAddress",
"") != ip_address:
33 warn(
"request from lobby on %s does not match %s" % (hdf.getValue(
"CGI.RemoteAddress",
""), ip_address))
36 warn(
"ip address is authorized")
38 if not os.path.exists(config.ROS_VAR_DIR):
40 os.mkdir(config.ROS_VAR_DIR, 0777)
41 takeover = open(TAKEOVER_FILE,
"w")
42 takeover.write(username)
47 if os.path.exists(TAKEOVER_FILE):
48 os.remove(TAKEOVER_FILE)
50 if hdf.getValue(
"Query.Action.Response",
"") ==
"allow":
51 self.redirectUri(config.gBaseURL +
"login/signin.py?Action.Logout=1")
52 elif hdf.getValue(
"Query.Action.Response",
"") ==
"deny":
53 self.redirectUri(config.gBaseURL +
"app/texas_web_teleop/texas_web_teleop_mini/")
59 page =
SignInPage(context, pagename=
"takeover", nologin=1)
67 if __name__ ==
"__main__":
def Action_Response(self, hdf)