Changeset 229


Ignore:
Timestamp:
06/05/09 13:56:00 (15 years ago)
Author:
nanardon
Message:
  • add login part
Location:
LATMOS-Accounts-Web
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts-Web/Makefile.PL

    r94 r229  
    1010requires 'YAML'; # This should reflect the config file format you've chosen 
    1111                 # See Catalyst::Plugin::ConfigLoader for supported formats 
     12requires 'Catalyst::Plugin::Authentication' => '0'; 
     13requires 'Catalyst::Plugin::Session' => '0'; 
     14requires 'Catalyst::Plugin::Session::Store::FastMmap' => '0'; 
     15requires 'Catalyst::Plugin::Session::State::Cookie' => '0'; 
    1216catalyst; 
    1317 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web.pm

    r221 r229  
    2020    Session::State::Cookie 
    2121    Session::Store::FastMmap 
     22    Authentication 
    2223    /; 
    2324 
     
    3435 
    3536__PACKAGE__->config( name => 'LATMOS::Accounts::Web' ); 
     37 
     38__PACKAGE__->config->{'Plugin::Authentication'} = { 
     39    default_realm => 'la', 
     40    realms => { 
     41        la => { 
     42            credential => { 
     43                class => 'La' 
     44            }, 
     45            store => { 
     46                class => 'Null', 
     47            }, 
     48        }, 
     49    }, 
     50}; 
     51 
    3652 
    3753# Start the application 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller.pm

    r225 r229  
    4242    } 
    4343    $c->stash->{mainmenu} = $menu; 
     44    if (!$c->user_exists && $c->req->path ne 'login') { 
     45        $c->forward('/login'); 
     46    } 
    4447} 
    4548 
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Root.pm

    r148 r229  
    3232} 
    3333 
     34sub login : Local { 
     35    my ( $self, $c ) = @_; 
     36 
     37    $c->stash->{template} = 'login.tt'; 
     38    if ($c->req->param('username')) { 
     39        if ($c->authenticate({ 
     40                username => $c->req->param('username'), 
     41                password => $c->req->param('password')})) { 
     42            $c->res->redirect($c->req->param('loguri') || '/'); 
     43        } else { 
     44            warn "invalid login"; 
     45        } 
     46    } 
     47} 
     48 
     49sub logout : Local { 
     50    my ( $self, $c ) = @_; 
     51    $c->logout; 
     52    $c->res->redirect('/'); 
     53} 
     54 
    3455=head2 end 
    3556 
Note: See TracChangeset for help on using the changeset viewer.