diff options
author | Michael Kröll <pepl@cpan.org> | 2008-12-01 23:00:37 +0100 |
---|---|---|
committer | Michael Kröll <pepl@cpan.org> | 2008-12-01 23:00:37 +0100 |
commit | 8560a6046fdeb1867dbbb3b131cfd6d0b4bfc4c1 (patch) | |
tree | bfe9a9a8bd9504700295ccab5eefd8e68a941ac1 /lib/PAUSE/OpenID/Controller/Root.pm | |
parent | Typo (diff) | |
parent | Merge branch 'master' of git@git.useperl.at:PAUSE-OpenID (diff) | |
download | Simple-OpenID-8560a6046fdeb1867dbbb3b131cfd6d0b4bfc4c1.tar.gz Simple-OpenID-8560a6046fdeb1867dbbb3b131cfd6d0b4bfc4c1.tar.bz2 Simple-OpenID-8560a6046fdeb1867dbbb3b131cfd6d0b4bfc4c1.zip |
Merge branch 'master' of git@git.useperl.at:PAUSE-OpenID
Diffstat (limited to 'lib/PAUSE/OpenID/Controller/Root.pm')
-rw-r--r-- | lib/PAUSE/OpenID/Controller/Root.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index 758eee6..566a0a1 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -4,6 +4,8 @@ use strict; use warnings; use parent 'Catalyst::Controller'; +use LWP::UserAgent; + # # Sets the actions in this controller to be registered with no prefix # so they function identically to actions created in MyApp.pm @@ -68,17 +70,28 @@ sub login :Local { $c->log->debug('username "'.$username.'" login attempt'); - $c->res->redirect($c->uri_for('/login_failed')); + my $ua = LWP::UserAgent->new; + $ua->credentials('pause.perl.org:443', 'PAUSE', $username, $password); + my $res = $ua->get('https://pause.perl.org/pause/authenquery'); + + if ($res->code == 200) { + $c->log->info('login pass'); + $c->res->redirect($c->uri_for('/login_pass')); + } + else { + $c->log->warn('login failed'); + $c->res->redirect($c->uri_for('/login_failed')); + } } -sub login_pass { +sub login_pass :Local { my ( $self, $c ) = @_; $c->res->content_type('text/plain'); $c->res->body('login pass'); } -sub login_failed { +sub login_failed :Local { my ( $self, $c ) = @_; $c->res->content_type('text/plain'); |