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.
except:
user = None
if user is None:
+ tokens = request.META
+
try:
eppn = tokens[Tokens.SHIB_EPPN]
except KeyError:
'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
</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>
<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>
<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>
(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('',