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