From: Nick J. <nje...@us...> - 2002-01-28 01:09:29
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv30022/bin Modified Files: sandweb.cgi Log Message: * changed generic 'sandweb' cookie, to 'sandweb_auth' and throught the CGI it is reffered to (and passed to functions as) ck_auth. ($ck_auth). This will seperate out ck_* to be able to use cookies for different things, like: ck_curr_menu (sandweb_curr_menu) ck_prev_menu (sandweb_prev_menu) Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.131 retrieving revision 1.132 diff -U2 -r1.131 -r1.132 --- sandweb.cgi 2002/01/27 02:39:55 1.131 +++ sandweb.cgi 2002/01/28 01:09:26 1.132 @@ -69,19 +69,19 @@ } else { - # if cookie exists, this will return it's data - my $cookie = cookie('sandweb'); + # if auth cookie exists, this will return it's data + my $ck_auth = CGI::cookie('sandweb_auth'); - if ($cookie) { - # cookie has been set - # verify cookie, and load user info - my $stat = $auth->load_user($cookie); + if ($ck_auth) { + # auth cookie has been set + # verify auth cookie, and load user info + my $stat = $auth->load_user($ck_auth); unless ($stat) { - # unable to load user with cookie, or cookie expired + # unable to load user with auth cookie, or auth cookie expired set_error("Please login first."); - $log->debug("unable to get valid cookie: '$cookie'"); + $log->debug("unable to get valid authentication cookie: '$ck_auth'"); login_menu(); exit 0; } - # has valid cookie + # has valid auth cookie @@ -91,6 +91,6 @@ # unless ($action) { - # with cookie, default is main_menu - main_menu( cookie => $cookie ); + # with auth cookie, default is main_menu + main_menu( ck_auth => $ck_auth ); } else { @@ -101,18 +101,18 @@ if ( $action eq 'main_menu' ) { # called main menu - main_menu( cookie => $cookie ); + main_menu( ck_auth => $ck_auth ); } elsif ( $action eq 'debug_menu' ) { # called test menu - debug_menu( cookie => $cookie ); + debug_menu( ck_auth => $ck_auth ); } elsif ( $action eq 'preferences_menu' ) { if (! CGI::param('Submit')) { # call preferences menu - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } else { # commit menu data - preferences_commit( cookie => $cookie,); + preferences_commit( ck_auth => $ck_auth,); } } @@ -128,5 +128,5 @@ } browse_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -139,5 +139,5 @@ } browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -148,5 +148,5 @@ @filename = CGI::param('filename'), file( - cookie => $cookie, + ck_auth => $ck_auth, file_command => CGI::param('file_command'), filename => \@filename, @@ -165,5 +165,5 @@ vcsaction( - cookie => $cookie, + ck_auth => $ck_auth, vcs_command => CGI::param('vcs_command'), location => CGI::param('location'), @@ -186,5 +186,5 @@ } vcs_prefs_menu( - cookie => $cookie, + ck_auth => $ck_auth, filename => $filename, command => $command, @@ -198,11 +198,15 @@ $log->error("$msg"); set_error("$msg"); - debug_menu( cookie => $cookie ); + # load current menu (instead of going to new one) + #no strict 'refs'; + #my $curr_menu = CGI::param('curr_menu'); + #&$curr_menu( ck_auth => $ck_auth); + debug_menu( ck_auth => $ck_auth ); } } - } + } else { - # no cookie, default login_menu - $log->debug("no cookie found: '$cookie'"); + # no auth cookie, default login_menu + $log->debug("no authentication cookie found: '$ck_auth'"); login_menu(); } @@ -246,6 +250,6 @@ $log->debug("entering main menu"); - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -253,10 +257,10 @@ if (! load_prefs()) { # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } - $log->debug("cookie: '$cookie'"); + $log->debug("auth cookie: '$ck_auth'"); - print CGI::header( -cookie => $cookie ); + print CGI::header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Main Menu', @@ -276,6 +280,6 @@ $log->debug("entering debug menu"); - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -286,5 +290,5 @@ $content = "Data Dump<br /><pre>" . $content . "</pre>"; - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Debug Menu', @@ -303,5 +307,5 @@ sub browse_menu { my %args = @_; - my $cookie = $args{'cookie'}; + my $ck_auth = $args{'ck_auth'}; my $no_modules = 0; # true if user has no repositories defined @@ -309,5 +313,5 @@ $log->debug("entering browse_menu()"); - unless ($cookie) { + unless ($ck_auth) { &login_menu(); exit 0; @@ -337,5 +341,5 @@ my $username = $auth->get_userinfo('username'); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Browse Menu', @@ -353,14 +357,14 @@ # # location - scalar to specify where to browse. -# cookie - the sessions cookie +# ck_auth - the sessions cookie # sub browse_module_menu { my %args = @_; my $location = $args{'location'} || ''; - my $cookie = $args{'cookie'}; + my $ck_auth = $args{'ck_auth'}; $log->debug("entering browse_module_menu()"); - unless ($cookie) { + unless ($ck_auth) { &login_menu(); exit 0; @@ -368,5 +372,5 @@ if (! load_prefs()) { # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } my $username = $auth->get_userinfo('username'); @@ -429,5 +433,5 @@ my $content = $browse->browse("$location", "$progname", "@vcs_commands", "@file_commands", $repo_type); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Browse Repository Menu', @@ -449,6 +453,6 @@ $log->debug("entering file handling routine"); - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -456,5 +460,5 @@ if (! load_prefs()) { # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } @@ -490,5 +494,5 @@ set_error("Please select file(s) or folder(s) to remove."); browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -519,5 +523,5 @@ browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -587,5 +591,5 @@ ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : View File', @@ -615,5 +619,5 @@ file( - cookie => $cookie, + ck_auth => $ck_auth, file_command => "view", filename => \@filename, @@ -625,5 +629,5 @@ set_error("This does not appear to be a text file."); file( - cookie => $cookie, + ck_auth => $ck_auth, file_command => "view", filename => $filename, @@ -645,5 +649,5 @@ ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Edit File', @@ -662,5 +666,5 @@ $file->create_file(); browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -674,5 +678,5 @@ ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Create File', @@ -689,5 +693,5 @@ $file->create_folder(); browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -701,5 +705,5 @@ FULLPATH => "$users_dir/$username/$location", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE => 'SandWeb : Create Folder', @@ -729,5 +733,5 @@ browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -740,5 +744,5 @@ FULLPATH => "$users_dir/$username/$location", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Upload File', @@ -758,5 +762,5 @@ FULLPATH => "$users_dir/$username/$location", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Checkout', @@ -775,5 +779,5 @@ set_error("Invalid selection: $file_command"); browse_module_menu( - cookie => $cookie, + ck_auth => $ck_auth, location => $location, ); @@ -788,6 +792,6 @@ my %args = @_; - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -795,5 +799,5 @@ if (! load_prefs()) { # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } @@ -855,5 +859,5 @@ VCS_ERROR => "@vcs_error", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> "SandWeb : VCS $vcs_command", @@ -873,5 +877,5 @@ FILENAME => "@filename", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Commit', @@ -905,5 +909,5 @@ VCS_ERROR => "@vcs_error", ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> "SandWeb : VCS $vcs_command", @@ -921,6 +925,6 @@ sub preferences_menu { my %args = @_; - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -939,5 +943,5 @@ ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Preferences Menu', @@ -953,6 +957,6 @@ sub vcs_prefs_menu { my %args = @_; - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -1021,5 +1025,5 @@ ); - print CGI::header( -cookie => $cookie ); + print CGI::header( -ck_auth => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : Preferences Menu', @@ -1040,6 +1044,6 @@ sub preferences_commit { my %args = @_; - my $cookie = $args{'cookie'}; - unless ($cookie) { + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { &login_menu(); exit 0; @@ -1085,9 +1089,9 @@ $log->error("$msg"); set_error("$msg"); - preferences_menu( cookie => $cookie ); + preferences_menu( ck_auth => $ck_auth ); } # when finished go to main menu. (this should be dynamic probably, so it # returns to whichever menu they wanted to go to in the first place). - main_menu( cookie => $cookie ); + main_menu( ck_auth => $ck_auth ); } @@ -1164,10 +1168,10 @@ if ($stat) { $log->standard("$username logged on."); - my $cookie = cookie( $auth->set_cookie() ); - unless ($cookie) { - set_error("unable to set cookie: '$cookie'"); + my $ck_auth = CGI::cookie( $auth->set_auth_cookie() ); + unless ($ck_auth) { + set_error("unable to set authentication cookie: '$ck_auth'"); login_menu(); } - main_menu( cookie => $cookie ); + main_menu( ck_auth => $ck_auth ); } else { |