Well, in the example you posted, you don''t have quotes around the
second
"http://loginpage.html/"... though maybe that''s just a error
in copying.
Other than that, maybe try some logging in there to see what''s
happening...
b
PS: Oh, one more thing... I think most people usually do their logged in
check in the ApplicationController (application.rb) and hook it up as a
before_filter for all their actions. That way you won''t have to put
ifLoggedIn in every single view.
Chris Earle wrote:> Hi all,
>
> I cannot get this to work at all .. it never does the redirect.
>
> I have two authentication cookies set ... Rails reads thier values fine if
> they exist
>
> If they don''t exist, I want to redirect the user to the login page
-- which
> is not a rails controller/model ....(single sign on location)
>
> I figured I''d add the code to the application_helper ... so that I
could
> reference it in all my views.
>
>
> module ApplicationHelper
>
> def ifLoggedIn()
> useridcookie=cookies[:UserID]
> usersessioncookie=cookies[:usersession]
> if (!useridcookie)
> redirect_to "http://loginpage.html"
> end
> if (!usersessioncookie)
> redirect_to http://loginpage.html
> end
> end
> end
>
>
> -----
>
> in my view (list.rhtml), I call <% ifLoggedIn() %>
> right at the top
>
>
> Any help much appreciated!
>
>
>
>
>
>
> --
> Chris
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---