Ignore:
Timestamp:
01/08/16 10:04:06 (9 years ago)
Author:
nanardon
Message:

Fix redirect when login

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Root.pm

    r1582 r1609  
    4646    } else { 
    4747        # No need to login for About section 
    48         $c->forward('login'); 
     48        $c->forward('needlogin'); 
    4949        return; 
    5050    } 
     
    6060} 
    6161 
     62sub needlogin : Private { 
     63    my ( $self, $c ) = @_; 
     64 
     65    $c->session->{redirurl} ||= $c->req->uri; 
     66    $c->session->{redirparam} ||= $c->req->params; 
     67 
     68    my $sslid = $c->config->{ssl}->{SSL_ID} || 'HTTP_SSL_CLIENT_S_DN_EMAIL'; 
     69    $c->stash->{sslid} = $ENV{$sslid}; 
     70 
     71    $c->stash->{template} = 'login.tt'; 
     72} 
     73 
    6274sub login : Local { 
    6375    my ( $self, $c ) = @_; 
    64  
    65     $c->stash->{redirurl} = $c->req->uri unless($c->req->path =~ /^login/);  
    6676 
    6777    my $sslid = $c->config->{ssl}->{SSL_ID} || 'HTTP_SSL_CLIENT_S_DN_EMAIL'; 
     
    7585                ssl      => $c->req->param('use_ssl')  || '', 
    7686        })) { 
    77             my $redirurl = $c->stash->{redirurl}; 
    78             $c->stash->{redirurl} = undef; 
    79             $c->res->redirect($redirurl || $c->uri_for('/')); 
     87            my $redirurl = $c->session->{redirurl}; 
     88            $redirurl->query_form(%{ $c->session->{redirparam} || {}}); 
     89            $c->session->{redirurl} = undef; 
     90            $c->session->{redirparam} = undef; 
     91            $c->res->redirect($redirurl || $c->uri_for('/'), ); 
    8092        } else { 
    8193            # invalid login... 
Note: See TracChangeset for help on using the changeset viewer.