annotate tests/utest.ur @ 21:354dae3008de

Fix embarrassing bug that deleted sessions that were too new, rather than old
author Adam Chlipala <adam@chlipala.net>
date Sat, 08 Jan 2011 18:47:27 -0500
parents 5e03668972ea
children e5df3d3554d3
rev   line source
adam@19 1 style inputs
adam@19 2
adam@19 3 structure U = OpenidUser.Make(struct
adam@19 4 con cols = [Nam = string]
adam@19 5
adam@19 6 val sessionLifetime = 3600
adam@19 7 val afterLogout = bless "/main"
adam@19 8 val secureCookies = False
adam@19 9 val association = Openid.Stateful {AssociationType = Openid.HMAC_SHA256,
adam@19 10 AssociationSessionType = Openid.NoEncryption}
adam@19 11 val realm = None
adam@19 12
adam@19 13 val creationState =
adam@19 14 n <- source "";
adam@19 15 return {Nam = n}
adam@19 16
adam@19 17 fun render r = <xml>
adam@19 18 <tr> <th class={inputs}>Name:</th> <td><ctextbox source={r.Nam}/></td> </tr>
adam@19 19 </xml>
adam@19 20
adam@21 21 fun ready _ = return True
adam@21 22
adam@19 23 fun tabulate r =
adam@19 24 n <- signal r.Nam;
adam@19 25 return {Nam = n}
adam@19 26
adam@19 27 fun choose _ r = return r
adam@19 28
adam@19 29 val formClass = inputs
adam@19 30 end)
adam@19 31
adam@19 32 fun wrap title body =
adam@19 33 userStuff <- U.main wrap;
adam@19 34 return <xml><head>
adam@19 35 <title>{[title]}</title>
adam@19 36 </head><body>
adam@19 37 {userStuff}
adam@19 38
adam@19 39 <h1>{[title]}</h1>
adam@19 40
adam@19 41 {body}
adam@19 42 </body></xml>
adam@19 43
adam@19 44 fun main () =
adam@19 45 whoami <- U.current;
adam@19 46 wrap "Main page" (case whoami of
adam@19 47 None => <xml>I don't think you're logged in.</xml>
adam@19 48 | Some whoami => <xml>Apparently you are <b>{[whoami]}</b>!</xml>)