Ignore:
Timestamp:
01/26/12 16:14:06 (12 years ago)
Author:
nanardon
Message:
  • allow ssl login, match user using email address, this still allow basic authentication
File:
1 edited

Legend:

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

    r886 r888  
    44use warnings; 
    55use base 'Catalyst::Controller'; 
    6 use MIME::Base64; 
    76 
    87# 
     
    3736    my ( $self, $c ) = @_; 
    3837 
     38    require Data::Dumper; 
    3939    if ($c->user_exists) { 
    4040        # Set login user: 
    41         warn $c->model('Accounts')->db->{_user} = $c->user->{username}; 
     41        $c->model('Accounts')->db->{_user} = $c->user->{username}; 
    4242    } else { 
    4343        # No need to login for About section 
    44         if ($c->namespace ne 'about') { 
    45             if ($c->authenticate({}, 'remote')) { 
    46                 # Set login user: 
    47                 $c->model('Accounts')->db->{_user} = $c->user->{username}; 
    48             } elsif (my $authheader = $c->req->headers->header('Authorization')) { 
    49                 # TODO check auth type 
    50                 my ($type, $base64) = $authheader =~ /(\w+) (\S+)/; 
    51                 my ($login, $pass) = decode_base64($base64) =~ /^([^:]+):(.*)/; 
    52                 if (!$c->authenticate({  
    53                             username => $login, 
    54                             password => $pass }, 'la')) { 
    55                     $c->forward('auth_required'); 
    56                     return; 
    57                 } 
    58             } else { 
    59                 $c->forward('auth_required'); 
    60                 return; 
    61             } 
     44        if (!$c->authenticate({}, 'la')) { 
     45            $c->forward('auth_required'); 
     46            return; 
    6247        } 
    6348    } 
Note: See TracChangeset for help on using the changeset viewer.