comparison 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
comparison
equal deleted inserted replaced
1051:731e6aa6655a 1052:7e3226c97678
1 cookie user : {EMail : string}
2
3 fun main () =
4 ro <- getCookie user;
5 case ro of
6 Some u => welcome u
7 | _ => login ()
8
9 and welcome u = return <xml><body>
10 Welcome {[u.EMail]}. <a link={logout ()}>Logout</a>
11 </body></xml>
12
13 and logout () =
14 clearCookie user;
15 main ()
16
17 and login () = return <xml><body>
18 <form>E-mail:<textbox{#EMail}/><submit action={signin}/></form>
19 </body></xml>
20
21 and signin r =
22 setCookie user {Value = {EMail = r.EMail},
23 Expires = None, (* Some (readError "2012-11-6
24 00:00:00"), *)
25 Secure = False
26 };
27 main ()