Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: RFC: Proposed tutorial - simple login script using CGI::Application

by Anonymous Monk
on Jan 21, 2016 at 16:07 UTC ( #1153293=note: print w/replies, xml ) Need Help??


in reply to Re^6: RFC: Proposed tutorial - simple login script using CGI::Application
in thread RFC: Proposed tutorial - simple login script using CGI::Application

Hi,
STORE => 'Session', #LOGOUT_RUNMODE => 'logout', #LOGIN_RUNMODE => 'login', POST_LOGIN_RUNMODE => 'okay', POST_LOGIN_URL =>'http://localhost/cgi-bin/WebApp/vpage.cgi', RENDER_LOGIN => \&my_login_form,
In the browser trying login page URL "http://localhost/cgi-bin/WebApp/simple.pl" after successful login the page getting redirect to new URL http://localhost/cgi-bin/WebApp/vpage.cgi, the problem is anyone can try directly access to "http://localhost/cgi-bin/WebApp/vpage.cgi" it will show the page without login.

Trying to hide the page http://localhost/cgi-bin/WebApp/vpage.cgi, users

Many Thanks...

  • Comment on Re^7: RFC: Proposed tutorial - simple login script using CGI::Application
  • Download Code

Replies are listed 'Best First'.
Re^8: RFC: Proposed tutorial - simple login script using CGI::Application
by scorpio17 (Canon) on Jan 21, 2016 at 17:01 UTC
    It's important that all your pages be CGI::Application 'runmodes', and if you think about it in object-oriented programming terms, all of your runmodes should be methods of objects derived from some abstract base class that is itself derived from CGI::Application. Your base class contains the login logic. That way all derived classes inherit that functionality. If you redirect to some random CGI script that isn't derived from that base class, then you're right - you just bypassed your login logic. Fortunately, all you probably need to do is add:
    use base 'MyLib::Login';
    to your vpage.cgi script.
      Thank you! Let me try this...
        Hi, Unfortunately it doesn’t works and behaves same manner, it there any way to create the index.html page without HTML template (i'm looking for CGI) I have seen the some webpage like ‘http://localhost/cgi-bin/web/login’ and once success logged in the page moving to different page eg(http://localhost/cgi-bin/web/search/text) and once logged out the page automatically redirect to original login page, however after logout when trying to access to (http://localhost/cgi-bin/web/search/text) its forced to redirect to default login page - could you please suggest on this, Many Thanks.
Re^8: RFC: Proposed tutorial - simple login script using CGI::Application
by Corion (Patriarch) on Jan 21, 2016 at 16:09 UTC

    How is this Perl code I could run?

      vpage.cgi - perl code
      #!/usr/bin/perl use strict; #use warnings; use Encode qw( decode_utf8 ); use CGI; my $q= new CGI; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); print $q->header( "text/html" ); print "Testing another page";

        And where in this page do you issue the redirect?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1153293]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2023-02-07 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (38 votes). Check out past polls.

    Notices?