This is odd, the problem seems to be happening when I switch machines,
I logged out and in several times at work today to try and trigger the
problem. When I came home I still had the cookie so everything worked
ok, I logged out, looks like this now:

(de logout ()
   (setq *Cookies NIL)
   (cookie 'uid NIL)

No redirects anymore, and when I tried to log back in I got exactly
the same problem, despite removing the redirect and having (start)
look like this:

(de start () (off *JS) (if (getUsr) (desktop) (signin)))

So no JS either. If you're out of ideas I'll try to reproduce the
problem with a simple app that you can easily run.


On Tue, Nov 24, 2009 at 10:57 AM, Henrik Sarvell <> wrote=
> Yes (redir) is just a shortcut to:
> (de redir (Func)
> =A0 (redirect (pack *Domain (or Func "@desktop"))))
>>>redirecting causes you to lose part of the session's context<<
> Good to know.
> I'm sorry, it seems like I missed to list (start) earlier:
> (de start () (if (getUsr) (desktop) (signin)))
> This is the entry point, it will try and get a user object with the
> help of the user id in the cookie, if it can't it will simply call
> signin which when submitted routes to the dead end (sometimes).
> In fact (usrQuit) and (logout) actually doesn't have anything to do
> with the problem at hand since they are not called at all. I'm sorry
> that I've been unnecessarily confusing.
> I suppose we're back to the beginning here if manipulating *SesId
> won't help me and since I'm not doing unnecessary redirects in this
> case?
> Obviously the form is rendered correctly and when I submit the
> following should be executed since I'm pretty sure I enter the right
> password:
> (prog
> =A0(cookie 'uid Uid)
> =A0(setq *Cookies (cons 'uid Uid))
> =A0(redir))
> And (redir) should render the desktop. However somehow something else
> cuts in between, but only sometimes when the server has been running
> for some time, never when I just restarted it.
> Could this thing that captures the button click before I have time to
> redirect be something in the new JavaScript stuff you've been doing
> lately?
> On Tue, Nov 24, 2009 at 10:01 AM, Alexander Burger <> =
>> On Tue, Nov 24, 2009 at 09:27:16AM +0100, Henrik Sarvell wrote:
>>> I think I understand, how would I properly log someone out of the
>>> normal GUI, ie when using (app) et al, setting *SesId to NIL maybe? I
>>> just browsed http.l and noticed that variable.
>> I would not manipulate '*SesId'. This would just give errors due to
>> illegal accesses to the session.
>> I use "lib/adm.l", which has functions for login and logout. I'm not
>> sure in your case, but for terminating a session just (bye) might also
>> suffice.
>>> (de usrQuit ()
>>> =A0 (let Usr (getUsr)
>>> =A0 =A0 =A0(or Usr (redir "@logout"))))
>> What does 'redir' do? Something like 'redirect' in "lib/http.l"? Then it
>> would be better to call (logout) directly instead of redirecting to
>> "@logout", wouldn't it? Also, this would avoid an additional HTTP
>> transaction.
>>> So the following redirects to logout if the user id is not in a cookie:
>>> (de logout ()
>>> =A0 =A0(setq *Cookies NIL)
>>> =A0 =A0(cookie 'uid NIL)
>>> =A0 =A0(redir "@start"))
>> Same here. I would directly call 'start' or any other functions needed.
>>> (de signin ()
>>> =A0 =A0(app)
>>> =A0 =A0(action
>>> =A0 =A0 =A0 (html 0 "RSS Reader" *Css NIL
>>> =A0 =A0 =A0 =A0 =A0(form NIL
>>> =A0 =A0 =A0 =A0 =A0 =A0 (<table> NIL NIL NIL
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL "Username" =A0(gui 'uname '(+=
TextField) 10))
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL "Password" =A0(gui 'pwd =A0 '=
(+PwField) =A0 10))
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (gui '(+Button) "Login"
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'(let Uid (chkLogin (val> (:=
 home uname)) (val>
>>> (: home pwd)))
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(if Uid
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (prog
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(cookie =
'uid Uid)
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(setq *C=
ookies (cons 'uid Uid))
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(redir))
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (err "Could not=
>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(<row> NIL (<href> "Sign Up" "@register"=
>>> It was after pressing the Login button here I got the problem,
>>> redirecting to, and rendering the login form was not a problem.
>> Thre redirecting causes you to lose part of the session's context.
>> Perhaps it all works if you just do the processig directly, as I
>> suggested? The code will probably also become much simpler.
>> You could try to just use the 'login' function from "lib/adm.l", as in
>> "app/gui.l". I think that it has all necessary mechanisms.
>> Cheers,
>> - Alex
>> --

Reply via email to