Yes (redir) is just a shortcut to:

(de redir (Func)
   (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

Obviously the form is rendered correctly and when I submit the
following should be executed since I'm pretty sure I enter the right

  (cookie 'uid Uid)
  (setq *Cookies (cons 'uid Uid))

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

On Tue, Nov 24, 2009 at 10:01 AM, Alexander Burger <> wr=
> 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 '(+T=
extField) 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 *Co=
okies (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