summaryrefslogtreecommitdiff
path: root/tests/vlad3.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-27 09:12:46 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-27 09:12:46 -0500
commit8b892b4ceaaaab751a68edc8fd01ecd2246d3dab (patch)
tree15b6d42341953d7bdb5b73f29445391070b5b57d /tests/vlad3.ur
parentd6ad8ebc3a44749cf04adf7f0e8dec1106f5f280 (diff)
Fix handling of clearCookie/getCookie in same page gen
Diffstat (limited to 'tests/vlad3.ur')
-rw-r--r--tests/vlad3.ur27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/vlad3.ur b/tests/vlad3.ur
new file mode 100644
index 00000000..3d1e812b
--- /dev/null
+++ b/tests/vlad3.ur
@@ -0,0 +1,27 @@
+cookie user : {EMail : string}
+
+fun main () =
+ ro <- getCookie user;
+ case ro of
+ Some u => welcome u
+ | _ => login ()
+
+and welcome u = return <xml><body>
+ Welcome {[u.EMail]}. <a link={logout ()}>Logout</a>
+</body></xml>
+
+and logout () =
+ clearCookie user;
+ main ()
+
+and login () = return <xml><body>
+ <form>E-mail:<textbox{#EMail}/><submit action={signin}/></form>
+</body></xml>
+
+and signin r =
+ setCookie user {Value = {EMail = r.EMail},
+ Expires = None, (* Some (readError "2012-11-6
+00:00:00"), *)
+ Secure = False
+ };
+ main ()