annotate tests/utest.ur @ 25:c560ec5bf514

More flexibility in placement of login form and other similar stuff
author Adam Chlipala <adam@chlipala.net>
date Thu, 20 Jan 2011 12:23:44 -0500
parents e5df3d3554d3
children 35d06874bec4
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@23 30
adam@23 31 val fakeId = None
adam@19 32 end)
adam@19 33
adam@19 34 fun wrap title body =
adam@19 35 userStuff <- U.main wrap;
adam@19 36 return <xml><head>
adam@19 37 <title>{[title]}</title>
adam@19 38 </head><body>
adam@25 39 {userStuff.Status}<br/>
adam@25 40 {userStuff.Other}
adam@19 41
adam@19 42 <h1>{[title]}</h1>
adam@19 43
adam@19 44 {body}
adam@19 45 </body></xml>
adam@19 46
adam@19 47 fun main () =
adam@19 48 whoami <- U.current;
adam@19 49 wrap "Main page" (case whoami of
adam@19 50 None => <xml>I don't think you're logged in.</xml>
adam@19 51 | Some whoami => <xml>Apparently you are <b>{[whoami]}</b>!</xml>)