FAQ
How, if it is possible, to allow login optionally for accessing some parts of the web application?
I created an action for simply displaying either one of two sets of links of URL storing in a database, and I want
to allow users to access different results of the actions,to either first sets of links or second sets of links,
based on whether or not the user logins (by using TT2 to post the link if the user has a particular role ).

I tried, in the App.pm, to not to force login for such action:

sub begin : Global {
my ($self, $c) = @_;

# don't force login
return 1 if ($c->req->{path} =~ /^static|optionalLoginAction/);

# force login for all pages
unless ($c->req->{user}) {
$c->req->action(undef);
$c->forward('/login/login');
}
}

Which would work the way I want. However, if after I login and logout with username that has the role for
accessing one (out of two) set of url link, and pass the back button on the browser, the previous page
would show up from the browser's cache, which is not what I want to happen. What I need is to force
this action to be reload every time when request of this action is called from the browser, because if
I manually reload the action with the browser's reload button, the result of this action with the correct link
will show up.

Does anyone have any suggestion of how to accomplish this type of option login mechanism?

Search Discussions

  • Wade Stuart at Sep 29, 2005 at 8:35 pm

    How, if it is possible, to allow login optionally for accessing some
    parts of the web application?
    I created an action for simply displaying either one of two sets of
    links of URL storing in a database, and I want
    to allow users to access different results of the actions,to either
    first sets of links or second sets of links,
    based on whether or not the user logins (by using TT2 to post the
    link if the user has a particular role ).
    I am unable to tell from your post if this is an actual program logic issue
    or cache issue, from what I read it sounds more like cache.

    maybe take a look at http://www.perlmonks.org/index.pl?node_id#9698 (post
    showing a full out no cache setup) and verify that you are setting cache
    directives to force no caching on the sensitive pages? If this is a
    program logic issues can you please try to reword the question to be more
    specific, maybe with a real world example. If you need help with how to
    set such cache settings in your cat app let me know and I can get into more
    Cat specific details.


    Which would work the way I want. However, if after I login and
    logout with username that has the role for
    accessing one (out of two) set of url link, and pass the back button
    on the browser, the previous page
    would show up from the browser's cache, which is not what I want to

    This is what is leading me to think it is a cache issue in entirety, as if
    the page cache settings were set to nocache the browser should not display
    the pervious page period.
    happen. What I need is to force
    this action to be reload every time when request of this action is
    called from the browser, because if
    I manually reload the action with the browser's reload button, the
    result of this action with the correct link
    will show up.

    Does anyone have any suggestion of how to accomplish this type of
    option login mechanism?




    _______________________________________________
    Catalyst mailing list
    Catalyst@lists.rawmode.org
    http://lists.rawmode.org/mailman/listinfo/catalyst
  • Sai Tong at Oct 3, 2005 at 9:15 pm

    Wade.Stuart@fallon.com wrote:



    How, if it is possible, to allow login optionally for accessing some
    parts of the web application?
    I created an action for simply displaying either one of two sets of
    links of URL storing in a database, and I want
    to allow users to access different results of the actions,to either
    first sets of links or second sets of links,
    based on whether or not the user logins (by using TT2 to post the
    link if the user has a particular role ).

    I am unable to tell from your post if this is an actual program logic issue
    or cache issue, from what I read it sounds more like cache.

    maybe take a look at http://www.perlmonks.org/index.pl?node_id#9698 (post
    showing a full out no cache setup) and verify that you are setting cache
    directives to force no caching on the sensitive pages? If this is a
    program logic issues can you please try to reword the question to be more
    specific, maybe with a real world example. If you need help with how to
    set such cache settings in your cat app let me know and I can get into more
    Cat specific details.


    After seeing your response and researching for more relevant
    information, I thinks this is more of a browser cache problem.
    So for now in order to more correctly set the cache setting to force no
    caching on the sensitive page, I am putting these lines
    in the relevant actions of my cat application:


    $c->res->headers->header('Expires' => '-1' );
    $c->res->headers->header('Pragma' => 'no-cache' );
    $c->res->headers->header('Cache-control' => 'no-cache,
    no-store,must-revalidate, post-check=0, pre-check=0' )

    Is it how one should to do for setting cache setting in the header of
    pages generated by cat? Any one has any suggestion?


    Which would work the way I want. However, if after I login and
    logout with username that has the role for
    accessing one (out of two) set of url link, and pass the back button
    on the browser, the previous page
    would show up from the browser's cache, which is not what I want to

    This is what is leading me to think it is a cache issue in entirety, as if
    the page cache settings were set to nocache the browser should not display
    the pervious page period.


    happen. What I need is to force
    this action to be reload every time when request of this action is
    called from the browser, because if
    I manually reload the action with the browser's reload button, the
    result of this action with the correct link
    will show up.

    Does anyone have any suggestion of how to accomplish this type of
    option login mechanism?




    _______________________________________________
    Catalyst mailing list
    Catalyst@lists.rawmode.org
    http://lists.rawmode.org/mailman/listinfo/catalyst

    _______________________________________________
    Catalyst mailing list
    Catalyst@lists.rawmode.org
    http://lists.rawmode.org/mailman/listinfo/catalyst

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedSep 29, '05 at 4:30p
activeOct 3, '05 at 9:15p
posts3
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Sai Tong: 2 posts Wade Stuart: 1 post

People

Translate

site design / logo © 2022 Grokbase