added openid error codes

git-svn-id: http://yolanda.mister-muffin.de/svn@270 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2008-04-04 05:40:21 +00:00
parent 2151fe409d
commit 6c0ec6d0ba
2 changed files with 11 additions and 13 deletions

View file

@ -60,6 +60,11 @@
<string id="error_no_query">You passed no query string.</string> <string id="error_no_query">You passed no query string.</string>
<string id="error_no_ogg_plugin">Your browser does not support Ogg Theora video playback.</string> <string id="error_no_ogg_plugin">Your browser does not support Ogg Theora video playback.</string>
<string id="error_no_video">There is no video matching your request</string> <string id="error_no_video">There is no video matching your request</string>
<string id="error_openid_no_identity_server">The provided URL doesn't declare its OpenID identity server</string>
<string id="error_openid_empty_url">No URL entered</string>
<string id="error_openid_bogus_url">Invalid URL</string>
<string id="error_openid_no_head_tag">URL provided doesn't seem to have a head tag</string>
<string id="error_openid_url_fetch_error">Error fetching the provided URL</string>
<string id=""></string> <string id=""></string>
<!-- information --> <!-- information -->

View file

@ -25,7 +25,7 @@ elsif($userinfo->{'username'})
print output_page(); print output_page();
} }
#if password is empty and username begins with http:// or ret is specified, then it's an openid login #if password is empty and username begins with http:// then it's an openid login
elsif($query->param('pass') eq '' and $query->param('user')=~m/^http:\/\//) elsif($query->param('pass') eq '' and $query->param('user')=~m/^http:\/\//)
{ {
#create our openid consumer object #create our openid consumer object
@ -43,23 +43,17 @@ elsif($query->param('pass') eq '' and $query->param('user')=~m/^http:\/\//)
$claimed = $con->claimed_identity($query->param('user')); $claimed = $con->claimed_identity($query->param('user'));
if(!defined($claimed)) if(!defined($claimed))
{ {
print $session->header(); print $query->redirect("/index.pl?error=error_openid_".$con->errcode);
print "claim failed: ", $con->err;
} }
else
#try to set the check_url
eval
{ {
#try to set the check_url
$check_url = $claimed->check_url( $check_url = $claimed->check_url(
return_to => "$domain/login.pl?action=openid", #on success return to this address return_to => "$domain/login.pl?action=openid", #on success return to this address
trust_root => $domain); #this is the string the user will be asked to trust trust_root => $domain); #this is the string the user will be asked to trust
#redirect to openid server to check claim #redirect to openid server to check claim
print $query->redirect($check_url); print $query->redirect($check_url);
};
#if this fails
if ($@) {
print $query->redirect("/index.pl?error=error_202c");
} }
} }
else else
@ -89,8 +83,7 @@ elsif($query->param('action') eq 'openid')
elsif ($con->user_cancel) elsif ($con->user_cancel)
{ {
#cancelled - redirect to login form #cancelled - redirect to login form
print $session->header(); print $query->redirect("index.pl");
print "cancelled";
} }
elsif ($vident = $con->verified_identity) elsif ($vident = $con->verified_identity)
{ {
@ -117,7 +110,7 @@ elsif($query->param('action') eq 'openid')
{ {
#an error occured #an error occured
print $session->header(); print $session->header();
print "error validating identity: ", $con->err; print "error validating identity: ", $con->errcode;
} }
} }
#else it's a normal login #else it's a normal login