X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fopenid%2Fopenid.inc.php;h=507508412a08f5f2ffc8babfea303344258beb49;hb=7c7d62fce3e3973b576ffbc4051ba443d6a6b849;hp=455e9df2525c48d8c60a1b6f3aecc67868afadee;hpb=c1390811bf369427ff56838c96fca813c81b714c;p=platal.git diff --git a/modules/openid/openid.inc.php b/modules/openid/openid.inc.php index 455e9df..5075084 100644 --- a/modules/openid/openid.inc.php +++ b/modules/openid/openid.inc.php @@ -106,10 +106,11 @@ class OpenId // Answers the current request, and renders the response. Appends the |sreg| // data when not null. - public function AnswerRequest($is_authorized, $user = null, $sreg_data = null) + public function AnswerRequest($is_authorized, $sreg_data = null) { // Creates the response. - if ($is_authorized && $this->request->idSelect() && $user) { + if ($is_authorized && $this->request->idSelect()) { + $user = S::user(); $response = $this->request->answer( $is_authorized, null, $user->login(), $this->GetUserUrl($user)); } else { @@ -176,7 +177,7 @@ class OpenId // Renders the main XRDS page. public function RenderMainXrdsPage(&$page) { - header('Content-type: application/xrds+xml'); + pl_content_headers("application/xrds+xml"); $page->changeTpl('openid/idp_xrds.tpl', NO_SKIN); $page->assign('type2', Auth_OpenID_TYPE_2_0_IDP); $page->assign('sreg', Auth_OpenID_SREG_URI); @@ -186,7 +187,7 @@ class OpenId // Renders the XRDS page of |user|. public function RenderUserXrdsPage(&$page, User &$user) { - header('Content-type: application/xrds+xml'); + pl_content_headers("application/xrds+xml"); $page->changeTpl('openid/user_xrds.tpl', NO_SKIN); $page->assign('type2', Auth_OpenID_TYPE_2_0); $page->assign('type1', Auth_OpenID_TYPE_1_1); @@ -203,12 +204,16 @@ class OpenId header(sprintf('%s %d', $_SERVER['SERVER_PROTOCOL'], $web_response->code), true, $web_response->code); - foreach ($web_response->headers as $key => $value) { - header(sprintf('%s: %s', $key, $value)); - } + if (is_a($response, 'Auth_OpenID_ServerError')) { + print "Erreur lors de l'authentification OpenId: " . $response->toString(); + } else { + foreach ($web_response->headers as $key => $value) { + header(sprintf('%s: %s', $key, $value)); + } - header('Connection: close'); - print $web_response->body; + header('Connection: close'); + print $web_response->body; + } } exit; }