annotate tests/utest.ur @ 20:2342d9baa0df

New OpenidUser.Make parameter: ready
author Adam Chlipala <adam@chlipala.net>
date Thu, 06 Jan 2011 16:46:09 -0500
parents 5e03668972ea
children 354dae3008de
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@19 21 fun tabulate r =
adam@19 22 n <- signal r.Nam;
adam@19 23 return {Nam = n}
adam@19 24
adam@19 25 fun choose _ r = return r
adam@19 26
adam@19 27 val formClass = inputs
adam@19 28 end)
adam@19 29
adam@19 30 fun wrap title body =
adam@19 31 userStuff <- U.main wrap;
adam@19 32 return <xml><head>
adam@19 33 <title>{[title]}</title>
adam@19 34 </head><body>
adam@19 35 {userStuff}
adam@19 36
adam@19 37 <h1>{[title]}</h1>
adam@19 38
adam@19 39 {body}
adam@19 40 </body></xml>
adam@19 41
adam@19 42 fun main () =
adam@19 43 whoami <- U.current;
adam@19 44 wrap "Main page" (case whoami of
adam@19 45 None => <xml>I don't think you're logged in.</xml>
adam@19 46 | Some whoami => <xml>Apparently you are <b>{[whoami]}</b>!</xml>)