My user object has the following methods:

        login: function(message){
                new MyDialog({
                        caption: 'Please Login',
                        url: '/login',
                        width: '450px',
                        message: message,
                        jsonSuccess: function(json){
                                dbug.log("LOGIN SUCCESS")
                                Cookie.write('session', json["cookie"]);
                                user.fireEvent('loggedIn');
                        }
                });
        },
        logout: function(){
                dbug.log("LOGOUT");
                Cookie.dispose('session');
                this.fireEvent('loggedOut');
                window.location = '/';
        }

All was working well until I started adding pages with deeper paths.
The above code works in these two pages:  localhost:4000/  and
localhost:4000/admin   But with page localhost:4000/admin/users  the
call to dispose the cookie does not work.  The logout function does
everything correct expect actually dispose the cookie.

According to docs ( I am using mootools 1.2.3)
http://mootools.net/docs/core/Utilities/Cookie#Cookie:write  =>  In
order to share the Cookie with pages located in a different path, the
Cookie.options.domain value must be set.

When I try setting options for domain and path, the call to Cookie
write does not work:
Cookie.write('session', json["cookie"], {domain: 'localhost', path:
'/'});

This is seriously not the path of least surprise.  I've tried several
combinations for options and can't get it to work.  All I want is a
single cookie called "session" to be written or disposed anywhere in
my app.

Any advice?  thanks, Jon

Reply via email to