[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick common.pl and action ?



Well adding action to that loop in common.pl
causes login to go into an infinite loop :(

Here is some output from my debugger:
login.pl  274sub login
mainbin/login.pl92
LedgerSMB/User.pm sub new Line: 46
Caller: mainbin/login.pl316

LedgerSMB/User.pm sub login Line: 216
Caller: mainbin/login.pl319

LedgerSMB/User.pm sub check_recurring Line: 317
Caller: mainbin/login.pl372

LedgerSMB/Form.pm sub redirect Line: 565
Caller: mainbin/login.pl397

common.pl sub redirect Line: 35
Caller: FormLedgerSMB/Form.pm577

LedgerSMB/Form.pm sub new Line: 57
Caller: maincommon.pl90

LedgerSMB/User.pm sub fetch_config Line: 142
Caller: maincommon.pl103

LedgerSMB/User.pm sub get_baselabor Line: 1093
Caller: LedgerSMB::UserLedgerSMB/User.pm199

LedgerSMB/Form.pm sub db_init Line: 1872
Caller: maincommon.pl107

LedgerSMB/Form.pm sub dbconnect_noauto Line: 2047
Caller: FormLedgerSMB/Form.pm1877

login.pl  274sub login
maincommon.pl121
LedgerSMB/User.pm sub new Line: 46
Caller: mainbin/login.pl316

If I make a backup of $form->{action} then add it back at the end I can login
here is a diff of what I have so far:

--- common.pl.orig      2012-08-04 19:28:37.000000000 -0700
+++ common.pl   2012-08-04 19:38:18.000000000 -0700
@@ -22,12 +22,12 @@
 use LedgerSMB::Sysconfig;

 sub redirect {
+         my $action_back = $form->{action} ;
     use List::Util qw(first);
     my ( $script, $argv ) = split( /\?/, $form->{callback} );

     my @common_attrs = qw(
       dbh login favicon stylesheet titlebar password custom_db_fields vc
-      action
     );

     if ( !$script ) {    # http redirect to login.pl if called w/no args
@@ -61,9 +61,9 @@
     if ( !$form->{dbh} and ( $script ne 'admin.pl' ) ) {
         $form->db_init( \%myconfig );
     }
-
     require "bin/$script";
-    &{ $form->{action} };
+    ($form->{action}) ?  &{$form->{action}} : &{$action_back} ;
+
 }

 1;