Ignore:
Timestamp:
12/23/15 16:54:29 (9 years ago)
Author:
nanardon
Message:

Improve authentication/logout

File:
1 edited

Legend:

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

    r1305 r1532  
    2424=cut 
    2525 
    26 sub auth_required : Private { 
    27     my ( $self, $c ) = @_; 
    28     $c->forward('login'); 
    29 } 
    30  
    3126sub component_disabled : Private { 
    3227    my ( $self, $c ) = @_; 
     
    3732    my ( $self, $c ) = @_; 
    3833 
    39     $c->log->debug($c->config->{ssl}->{HTTP_SSL_CLIENT_I_DN}); 
    4034    if ($c->user_exists) { 
    4135        # Set login user: 
     
    4337    } else { 
    4438        # No need to login for About section 
    45         if (!$c->authenticate({ username => $c->req->param('username'), password => 
    46                     $c->req->param('password') }, 'la')) { 
    47             $c->forward('auth_required'); 
    48             return; 
    49         } 
     39        $c->forward('login'); 
     40        return; 
    5041    } 
    5142} 
     
    6354    my ( $self, $c ) = @_; 
    6455 
     56    $c->stash->{redirurl} = $c->req->uri unless($c->req->path =~ /^login/);  
     57 
     58    warn $c->config->{ssl}->{SSL_ID}; 
     59    my $sslid = $c->config->{ssl}->{SSL_ID} || 'HTTP_SSL_CLIENT_S_DN_EMAIL'; 
     60    $c->stash->{sslid} = $ENV{$sslid}; 
     61 
    6562    $c->stash->{template} = 'login.tt'; 
    6663    if ($c->req->param('username')) { 
    6764        if ($c->authenticate({ 
    68                 username => $c->req->param('username'), 
    69                 password => $c->req->param('password')})) { 
    70             my $redirurl = $c->uri_for($c->req->param('loguri') ||  '/'); 
     65                username => $c->req->param('username') || '', 
     66                password => $c->req->param('password') || '', 
     67                ssl      => $c->req->param('use_ssl')  || '', 
     68        })) { 
     69            my $redirurl = $c->stash->{redirurl}; 
     70            $c->stash->{redirurl} = undef; 
    7171            $c->res->redirect($redirurl || $c->uri_for('/')); 
    7272        } else { 
     
    7474        } 
    7575    } 
    76     my ($redirurl) = grep { $_ } ( 
    77         $c->req->param('loguri'), 
    78         ($c->req->path ? '/' . $c->req->path : undef), 
    79         $c->uri_for('/'), 
    80     ); 
    81     $c->stash->{redirurl} = $redirurl; 
    8276} 
    8377 
Note: See TracChangeset for help on using the changeset viewer.