comparison tests/cookieJsec.ur @ 736:796e42c93c48

Cookie signatures for RPCs
author Adam Chlipala <adamc@hcoop.net>
date Thu, 23 Apr 2009 16:13:02 -0400
parents
children
comparison
equal deleted inserted replaced
735:5ccb67665d05 736:796e42c93c48
1 table t : {Id : int}
2
3 cookie c : int
4
5 fun setter r =
6 setCookie c (readError r.Id);
7 return <xml>Done</xml>
8
9 fun writer () =
10 ido <- getCookie c;
11 case ido of
12 None => error <xml>No cookie</xml>
13 | Some id => dml (INSERT INTO t (Id) VALUES ({[id]}))
14
15 fun preWriter () = return <xml><body onload={onConnectFail (alert "RPC error")}>
16 <button onclick={writer ()} value="Write to database"/>
17
18 <a link={main ()}>Back</a>
19 </body></xml>
20
21 and main () = return <xml><body>
22 <form>
23 <textbox{#Id}/> <submit value="Get cookie" action={setter}/>
24 </form>
25
26 <form><submit action={preWriter} value="Prepare to write to database"/></form>
27 </body></xml>