I'm experiencing some unwanted behavior with regards to cookies, I
have a login form looking like this:

(de signin ()
   (app)
   (action
      (rss-html
         (form NIL
            (<table> NIL NIL NIL
               (<row> NIL "Username"  (gui 'uname '(+TextField) 10))
               (<row> NIL "Password"  (gui 'pwd   '(+PwField)   10))
               (<row> NIL (gui '(+Button) "Login"
                             '(let Uid (chkLogin (val> (: home uname))
(val> (: home pwd)))
                                 (if Uid
                                    (prog
                                       (cookie 'uid Uid)
                                       (redirect "@desktop"))
                                    (url "@signin")))))
               (<row> NIL (<href> "Sign Up" "@register")))))))

So on successful login we jump to @desktop, that is actually another
separate problem, I want to jump to http://localhost:8080/@desktop but
the GUI stuff is overriding something so I end up for instance at
http://localhost:54688/@desktop.

However, aside from that problem which probably can be solved fairly
easily it seems like the redirect itself interferes with the cookie
setup, because when I manually navigate to
http://localhost:8080/@desktop from the above unwanted url I see that
the cookie was not set after all.

Rewriting the signin function and using this code instead after the
Uid has been retrieved will make us stay with the form, no routing
takes place:

(if Uid
   (cookie 'uid 123455)
   (url "@signin"))

Using this code instead and then manually navigating to
http://localhost:8080/@desktop after logging in works, the cookie
information is now there. Since the only difference is that redirect,
I gather that it is somehow the problem but I can't understand why,
prog should execute in order and set the cookie and then redirect so
the cookie should therefore be available in (desktop) but it's not.

Even if the cookie information is not available after the redirect
call it should be there when manually navigating after that, shouldn't
it?

/Henrik
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to