source: trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Login.pm @ 1732

Last change on this file since 1732 was 1632, checked in by nanardon, 8 years ago

Fix session expired detection

File size: 1.3 KB
Line 
1package LATMOS::Accounts::Web::Controller::Login;
2use Moose;
3use namespace::autoclean;
4
5BEGIN { extends 'Catalyst::Controller'; }
6
7=head1 NAME
8
9LATMOS::Accounts::Web::Controller::Login - Catalyst Controller
10
11=head1 DESCRIPTION
12
13Catalyst Controller.
14
15=head1 METHODS
16
17=cut
18
19sub begin : Private {
20    return 1;
21}
22
23=head2 index
24
25=cut
26
27sub index :Path :Args(0) {
28    my ( $self, $c ) = @_;
29
30    my $sslid = $c->config->{ssl}->{SSL_ID} || 'HTTP_SSL_CLIENT_S_DN_EMAIL';
31    $c->stash->{sslid} = $ENV{$sslid};
32
33    if ($c->req->param('username')) {
34        if ($c->authenticate({
35                username => $c->req->param('username') || '',
36                password => $c->req->param('password') || '',
37                ssl      => $c->req->param('use_ssl')  || '',
38        })) {
39            my $redirurl = $c->session->{redirurl};
40            $redirurl->query_form(%{ $c->session->{redirparam} || {}});
41            $c->session->{redirurl} = undef;
42            $c->session->{redirparam} = undef;
43            $c->res->redirect($redirurl || $c->uri_for('/'), );
44        } else {
45            # invalid login...
46        }
47    }
48}
49
50=encoding utf8
51
52=head1 AUTHOR
53
54Olivier Thauvin,Guyancourt - B1428,+33 1 80285052,
55
56=head1 LICENSE
57
58This library is free software. You can redistribute it and/or modify
59it under the same terms as Perl itself.
60
61=cut
62
63__PACKAGE__->meta->make_immutable;
64
651;
Note: See TracBrowser for help on using the repository browser.