Add login welcome page.
authorAntony Chazapis <chazapis@gmail.com>
Wed, 19 Oct 2011 20:05:24 +0000 (23:05 +0300)
committerAntony Chazapis <chazapis@gmail.com>
Wed, 19 Oct 2011 20:05:24 +0000 (23:05 +0300)
pithos/im/login.py [moved from pithos/im/shibboleth.py with 93% similarity]
pithos/im/static/shibboleth.png [new file with mode: 0644]
pithos/im/static/twitter.png [new file with mode: 0644]
pithos/im/templates/index.html
pithos/im/templates/users_create.html
pithos/im/urls.py

similarity index 93%
rename from pithos/im/shibboleth.py
rename to pithos/im/login.py
index 703863d..a5b1e39 100644 (file)
@@ -51,7 +51,7 @@ class Tokens:
     SHIB_SESSION_ID = "HTTP_SHIB_SESSION_ID"
 
 
-def login(request):
+def shibboleth(request):
     """Register a user into the internal database
        and issue a token for subsequent requests.
        Users are authenticated by Shibboleth.
@@ -70,6 +70,8 @@ def login(request):
     except:
         user = None
     if user is None:
+        tokens = request.META
+        
         try:
             eppn = tokens[Tokens.SHIB_EPPN]
         except KeyError:
@@ -103,8 +105,9 @@ def login(request):
                                  'token': user.auth_token})
     
     response = HttpResponse()
-    expire_fmt = user.auth_token_expires.strftime('%a, %d-%b-%Y %H:%M:%S %Z')
-    response.set_cookie('X-Auth-Token', value=user.auth_token, expires=expire_fmt, path='/')
+    # TODO: Cookie should only be set at the client side...
+    #expire_fmt = user.auth_token_expires.strftime('%a, %d-%b-%Y %H:%M:%S %Z')
+    #response.set_cookie('X-Auth-Token', value=user.auth_token, expires=expire_fmt, path='/')
     if not next:
         response['X-Auth-User'] = user.uniq
         response['X-Auth-Token'] = user.auth_token
diff --git a/pithos/im/static/shibboleth.png b/pithos/im/static/shibboleth.png
new file mode 100644 (file)
index 0000000..f596fb0
Binary files /dev/null and b/pithos/im/static/shibboleth.png differ
diff --git a/pithos/im/static/twitter.png b/pithos/im/static/twitter.png
new file mode 100644 (file)
index 0000000..b0a33bb
Binary files /dev/null and b/pithos/im/static/twitter.png differ
index 308632e..919572e 100644 (file)
 </head>
 <body>
   <div class="container">
-    Welcome! Choose how to login.
+    <h2>Welcome</h2>
+    <p>Choose how to login!</p>
+    <div class="row">
+      <div class="span4">
+        <h4>Traditional</h4>
+        <form action="" class="form-stacked">
+          <fieldset>
+            <div class="clearfix">
+              <label for="username">Username:</label>
+              <div class="input">
+                <input class="span3" id="user-username" name="username" type="text" />
+              </div>
+            </div>
+            <div class="clearfix">
+              <label for="password">Password</label>
+              <div class="input">
+                <input class="span3" id="user-password" name="password" type="password" />
+              </div>
+            </div>
+          </fieldset>
+          <div class="">
+            <button type="submit" class="btn primary">Go</button>
+          </div>
+        </form>
+      </div>
+      <div class="span4">
+        <h4>Stylish</h4>
+        <form action="" class="form-stacked">
+          <fieldset>
+            <div class="clearfix">
+              <label for="token">Invitation:</label>
+              <div class="input">
+                <input class="span3" id="user-token" name="token" type="text" />
+              </div>
+            </div>
+          </fieldset>
+          <div class="">
+            <button type="submit" class="btn primary">Go</button>
+          </div>
+        </form>
+      </div>
+      <div class="span8">
+        <h4>Funky</h4>
+        <a href="login/shibboleth" alt="Shibboleth"><img src="/im/static/shibboleth.png" width="120" height="120"></a>
+        <a href="login/twitter" alt="Twitter"><img src="/im/static/twitter.png" width="120" height="120"></a>
+      </div>
+    </div>
   </div>
 </body>
 </html>
index 2fe8f2b..e40957f 100644 (file)
@@ -6,14 +6,14 @@
   <div class="clearfix">
     <label for="user-uniq">Uniq</label>
     <div class="input">
-      <input class="medium" id="user-uniq" name="uniq" type="text" />
+      <input class="span4" id="user-uniq" name="uniq" type="text" />
     </div>
   </div>
 
   <div class="clearfix">
     <label for="user-realname">Real Name</label>
     <div class="input">
-      <input class="large" id="user-realname" name="realname" type="text" />
+      <input class="span4" id="user-realname" name="realname" type="text" />
     </div>
   </div>
 
@@ -33,7 +33,7 @@
   <div class="clearfix">
     <label for="user-affiliation">Affiliation</label>
     <div class="input">
-      <input class="large" id="user-affiliation" name="affiliation" type="text" />
+      <input class="span4" id="user-affiliation" name="affiliation" type="text" />
     </div>
   </div>
 
index b5106bf..19bba18 100644 (file)
@@ -48,8 +48,8 @@ urlpatterns = patterns('pithos.im.views',
     (r'^admin/users/(\d+)/delete/?$', 'users_delete')
 )
 
-urlpatterns += patterns('',
-    (r'^login/shibboleth/?$', 'pithos.im.shibboleth.login')
+urlpatterns += patterns('pithos.im.login',
+    (r'^login/shibboleth/?$', 'shibboleth')
 )
 
 urlpatterns += patterns('',