Mercurial > openid
annotate tests/utest.ur @ 23:e5df3d3554d3
fakeId parameter
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 16 Jan 2011 13:21:34 -0500 |
parents | 354dae3008de |
children | c560ec5bf514 |
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@19 | 39 {userStuff} |
adam@19 | 40 |
adam@19 | 41 <h1>{[title]}</h1> |
adam@19 | 42 |
adam@19 | 43 {body} |
adam@19 | 44 </body></xml> |
adam@19 | 45 |
adam@19 | 46 fun main () = |
adam@19 | 47 whoami <- U.current; |
adam@19 | 48 wrap "Main page" (case whoami of |
adam@19 | 49 None => <xml>I don't think you're logged in.</xml> |
adam@19 | 50 | Some whoami => <xml>Apparently you are <b>{[whoami]}</b>!</xml>) |