Re: [Radiant] How to use session in tags?
Hi Vincent, I ran into this just the other day myself and I've done some digging. In theory you could override a method in SiteController and use it to pass the current user to @page after find_page() happens.. You would have to disable the cache in that case and make sure the page is rendered for each user. Or, you can use javascript to grab the user info from the controller. As for tags, you can create a tag that can output the necessary javascript. Then the problem is how to make it degrade gracefully... Personally, I don't want to disable the cache... but that will mean that I won't be able to display the logged-in status for people without javascript. -C On 26-Aug-08, at 5:06 AM, Vincent Pérès wrote: Hello, I would like to create something like that : http://lists.radiantcms.org/pipermail/radiant/2006-September/001695.html The goal is to display a 'login box' if the current user is not connected, else an 'account box'. But I can't access to the 'session'. I tried to enable the session like that : module CoreExtension::SiteControllerExtensions def self.included(base) base.class_eval do session :disabled = false end end end (and include this file to SiteController) It doesn't work. I found an other discution about : http://lists.radiantcms.org/pipermail/radiant/2007-November/ 007146.html But ir doesn't work too... can you explain me, what is the best way to do my feature? Thank you ! Vincent -- Posted via http://www.ruby-forum.com/. ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] How to use session in tags?
Hi Vincent, I've done with Javascript reading login information from a cookie like this: http://pastie.org/260306 Cheers, Casper (Cookie is a util object, btw, it's not built into javascript) On 26/08/2008, at 18:46, Christopher Dwan wrote: Hi Vincent, I ran into this just the other day myself and I've done some digging. In theory you could override a method in SiteController and use it to pass the current user to @page after find_page() happens.. You would have to disable the cache in that case and make sure the page is rendered for each user. Or, you can use javascript to grab the user info from the controller. As for tags, you can create a tag that can output the necessary javascript. Then the problem is how to make it degrade gracefully... Personally, I don't want to disable the cache... but that will mean that I won't be able to display the logged-in status for people without javascript. -C On 26-Aug-08, at 5:06 AM, Vincent Pérès wrote: Hello, I would like to create something like that : http://lists.radiantcms.org/pipermail/radiant/2006-September/001695.html The goal is to display a 'login box' if the current user is not connected, else an 'account box'. But I can't access to the 'session'. I tried to enable the session like that : module CoreExtension::SiteControllerExtensions def self.included(base) base.class_eval do session :disabled = false end end end (and include this file to SiteController) It doesn't work. I found an other discution about : http://lists.radiantcms.org/pipermail/radiant/2007-November/007146.html But ir doesn't work too... can you explain me, what is the best way to do my feature? Thank you ! Vincent -- Posted via http://www.ruby-forum.com/. ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Re: [Radiant] How to use session in tags?
I just store it in plain text. The pages that need the user to be logged in is of a special page type, checking the session. Also, the controllers in my custom extension checks for login. That way, there is no reason to encrypt the cookie data in any way, it is just a display thing, not for access control. Cheers, Casper On 26/08/2008, at 22:15, Christopher Dwan wrote: Hey Casper, Do you just store the name and association_name in the cookie in plain text or is there some facility that you use to encrypt the data..? -Chris On 26-Aug-08, at 10:06 AM, Casper Fabricius wrote: Hi Vincent, I've done with Javascript reading login information from a cookie like this: http://pastie.org/260306 Cheers, Casper (Cookie is a util object, btw, it's not built into javascript) On 26/08/2008, at 18:46, Christopher Dwan wrote: Hi Vincent, I ran into this just the other day myself and I've done some digging. In theory you could override a method in SiteController and use it to pass the current user to @page after find_page() happens.. You would have to disable the cache in that case and make sure the page is rendered for each user. Or, you can use javascript to grab the user info from the controller. As for tags, you can create a tag that can output the necessary javascript. Then the problem is how to make it degrade gracefully... Personally, I don't want to disable the cache... but that will mean that I won't be able to display the logged-in status for people without javascript. -C On 26-Aug-08, at 5:06 AM, Vincent Pérès wrote: Hello, I would like to create something like that : http://lists.radiantcms.org/pipermail/radiant/2006-September/001695.html The goal is to display a 'login box' if the current user is not connected, else an 'account box'. But I can't access to the 'session'. I tried to enable the session like that : module CoreExtension::SiteControllerExtensions def self.included(base) base.class_eval do session :disabled = false end end end (and include this file to SiteController) It doesn't work. I found an other discution about : http://lists.radiantcms.org/pipermail/radiant/2007-November/007146.html But ir doesn't work too... can you explain me, what is the best way to do my feature? Thank you ! Vincent -- Posted via http://www.ruby-forum.com/. ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant ___ Radiant mailing list Post: Radiant@radiantcms.org Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant