front page for non-MIT users (and other unath'd)
authorGreg Price <price@mit.edu>
Fri, 9 May 2008 06:10:57 +0000 (02:10 -0400)
committerGreg Price <price@mit.edu>
Fri, 9 May 2008 06:10:57 +0000 (02:10 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=510

code/main.py
code/templates/__init__.py
code/templates/unauth.tmpl [new file with mode: 0644]

index 9871088..24fe062 100755 (executable)
@@ -600,13 +600,18 @@ def info(user, fields):
     checkpoint.checkpoint('Got infodict')
     return templates.info(searchList=[d])
 
+def unauthFront(_, fields):
+    """Information for unauth'd users."""
+    return templates.unauth(searchList=[{'simple' : True}])
+
 mapping = dict(list=listVms,
                vnc=vnc,
                command=command,
                modify=modify,
                info=info,
                create=create,
-               help=helpHandler)
+               help=helpHandler,
+               unauth=unauthFront)
 
 def printHeaders(headers):
     """Print a dictionary as HTTP headers."""
@@ -617,8 +622,10 @@ def printHeaders(headers):
 
 def getUser():
     """Return the current user based on the SSL environment variables"""
-    username = os.environ['SSL_CLIENT_S_DN_Email'].split("@")[0]
-    return username
+    email = os.environ.get('SSL_CLIENT_S_DN_Email', None)
+    if email is None:
+        return None
+    return email.split("@")[0]
 
 def main(operation, user, fields):
     start_time = time.time()
@@ -674,6 +681,9 @@ if __name__ == '__main__':
         print 'Location: ' + os.environ['SCRIPT_NAME']+'/\n'
         sys.exit(0)
 
+    if u is None:
+        operation = 'unauth'
+
     if operation.startswith('/'):
         operation = operation[1:]
     if not operation:
index 8e94be7..d26672f 100644 (file)
@@ -1,4 +1,4 @@
-__all__ = 'info command error help invalid list vnc'.split()
+__all__ = 'info command error help invalid list unauth vnc'.split()
 for _name in __all__:
     try:
         _module = __import__(_name, globals(), {}, [_name])
diff --git a/code/templates/unauth.tmpl b/code/templates/unauth.tmpl
new file mode 100644 (file)
index 0000000..fb98440
--- /dev/null
@@ -0,0 +1,32 @@
+#from skeleton import skeleton
+#extends skeleton
+
+
+#def title
+Intro
+#end def
+
+#def body
+<h1>XVM &mdash; Virtual Servers for MIT </h1>
+
+<p><strong>xvm.mit.edu</strong> is a virtualization service for the
+MIT community.  We offer <strong>virtual machines</strong>&mdash;your
+own complete system on which you can start from our <strong>two-minute
+Debian</strong> Linux auto-install or install the operating
+<strong>system of your choice</strong>.  The service is <strong>free
+to any Athena account holder</strong>.  </p>
+
+<p>If you're a member of the MIT community, go <a
+href="https://xvm.mit.edu/"><strong>try out the service</strong>
+now</a>.  You'll need an <a href="http://ca.mit.edu/">MIT personal
+certificate</a>.</p>
+
+<p>xvm.mit.edu is provided by <a href="http://sipb.mit.edu/">SIPB</a>,
+the <strong>student computing group</strong> at MIT, with generous
+funding from <a href="http://web.mit.edu/ist/">IS&amp;T</a>.  Like all
+SIPB projects, we are independently run by our own team of volunteers,
+and we welcome new contributors.</p>
+
+<p>Questions and <strong>feedback welcome</strong> at <tt>xvm@mit.edu</tt>.</p>
+
+#end def