summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJozef Kutej <jozef@emo.cle.sk>2008-12-01 22:59:12 +0100
committerJozef Kutej <jozef@emo.cle.sk>2008-12-01 22:59:12 +0100
commit648d8bac2919aac370d251c839878b6d982e2d7a (patch)
tree4692db365a96d4477e387ecd0798e75a3d520bf9
parentMerge branch 'master' of git@git.useperl.at:PAUSE-OpenID (diff)
downloadSimple-OpenID-648d8bac2919aac370d251c839878b6d982e2d7a.tar.gz
Simple-OpenID-648d8bac2919aac370d251c839878b6d982e2d7a.tar.bz2
Simple-OpenID-648d8bac2919aac370d251c839878b6d982e2d7a.zip
working login/password check in login
-rw-r--r--lib/PAUSE/OpenID/Controller/Root.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm
index 41b767e..33c8884 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
@@ -52,17 +54,28 @@ sub login :Local {
$c->log->debug('username "'.$username.'" login attemp');
- $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');