Mercurial > urweb
diff tests/vlad3.ur @ 1052:7e3226c97678
Fix handling of clearCookie/getCookie in same page gen
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 27 Nov 2009 09:12:46 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/vlad3.ur Fri Nov 27 09:12:46 2009 -0500 @@ -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 ()