summaryrefslogtreecommitdiff
path: root/tests/cookieSec.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 19:12:12 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-16 19:12:12 -0400
commit777ba279e76f6d30de4d64948930ae0d0d17833c (patch)
tree7e56853b9d7b3d70846add897bdffc1d309cae94 /tests/cookieSec.ur
parent2f923a2b261ac47e5f44d26aa92b548bbad86e09 (diff)
Cookie signing working for forms
Diffstat (limited to 'tests/cookieSec.ur')
-rw-r--r--tests/cookieSec.ur24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/cookieSec.ur b/tests/cookieSec.ur
new file mode 100644
index 00000000..ea5c9116
--- /dev/null
+++ b/tests/cookieSec.ur
@@ -0,0 +1,24 @@
+table t : {Id : int}
+
+cookie c : int
+
+fun setter r =
+ setCookie c (readError r.Id);
+ return <xml>Done</xml>
+
+fun writer () =
+ ido <- getCookie c;
+ case ido of
+ None => error <xml>No cookie</xml>
+ | Some id => dml (INSERT INTO t (Id) VALUES ({[id]}));
+ return <xml>Done</xml>
+
+fun main () = return <xml><body>
+ <form>
+ <textbox{#Id}/> <submit value="Get cookie" action={setter}/>
+ </form>
+
+ <form>
+ <submit value="Write to database" action={writer}/>
+ </form>
+</body></xml>