%perl> my $referer = $ARGS{referer}||$ARGS{referrer}; my $page_action = $ARGS{page_action}; my $user = $ARGS{user}; $m->session->{loginReturnPage} = $ENV{HTTP_REFERER} if $referer; $m->session->{'l_user'} = $ARGS{'user'} if $user; if (exists($ARGS{redirect})) { $ARGS{redirect} = uri_unescape(uri_unescape($ARGS{redirect})); if ($ARGS{redirect} eq $REQ->uri) { $ARGS{redirect} = '/index.html'; } else { $m->session->{loginReturnPage} = $ARGS{redirect} ; } } else { $ARGS{redirect} = $m->session->{loginReturnPage}; } if ( $m->session->{'loggedin'} ) { if ( $ARGS{'redirect'} ) { my $redirect = $ARGS{'redirect'}; #shout "redirect: ".$redirect; $redirect =~ s/^\/account\/login\.html/\/account\//i; if ( $ARGS{'auth'} eq 'y' ) { my $u = new L6::User id => $m->session->{u}->{id}; unless ( $u->error ) { my $c = $u->generate_magic_cookie; if ( $redirect =~ m/\?/g ) { $redirect .= "&mc=$c"; } else { $redirect .= "?mc=$c"; } } } $m->redirect( $redirect ); } else { my $redirect = $m->session->{loginReturnPage}; #shout "redirect: ".$redirect; $redirect =~ s/^\/account\/login\.html/\/account\//i; unless ($redirect) { $redirect = '/account/'; } $m->redirect( $redirect ); } %perl> % } else {