## Done.
return user
+def bake_cookie(value):
+ """
+ Return a properly baked authentication-token cookie with the given VALUE.
+ """
+ return CGI.cookie('chpwd-token', value,
+ httponly = True,
+ secure = CGI.SSLP,
+ path = CFG.SCRIPT_NAME,
+ max_age = (CFG.SECRETLIFE - CFG.SECRETFRESH))
+
###--------------------------------------------------------------------------
### Authentication commands.
else:
t = mint_token(u)
CGI.redirect(CGI.action('list', u),
- set_cookie = CGI.cookie('chpwd-token', t,
- httponly = True,
- secure = CGI.SSLP,
- path = CFG.SCRIPT_NAME,
- max_age = (CFG.SECRETLIFE -
- CFG.SECRETFRESH)))
+ set_cookie = bake_cookie(t))
###----- That's all, folks --------------------------------------------------