From: Florent Bruneau Date: Tue, 27 May 2008 20:47:13 +0000 (+0200) Subject: Be sure the auth object is always filled. X-Git-Url: http://git.polytechnique.org/?p=dotclear.git;a=commitdiff_plain;h=16237aee741d94ace5850ce0c0e9cd1851fc0235 Be sure the auth object is always filled. Signed-off-by: Florent Bruneau --- diff --git a/_public.php b/_public.php index 19de04c..44f9d43 100644 --- a/_public.php +++ b/_public.php @@ -5,11 +5,12 @@ $core->url->register('xorgLogin', 'XorgLogin', '^admin/(xorg\.php)$', array('xor class xorgAuthWidget { static public function widget(&$w) { global $core; - if ($core->auth->xorg_infos['forlife']) { - return '

Tu es ' . $core->auth->xorg_infos['prenom'] . ' ' . $core->auth->xorg_infos['nom'] . '
' - . 'déconnexion

'; + $name = $core->auth->userID(); + if ($name) { + return '

Tu es ' . $core->auth->getInfo('user_displayname') . '
' + . 'déconnexion

'; } else { - return '

M\'authentifier via Polytechnique.org

'; + return '

M\'authentifier via Polytechnique.org

'; } } } diff --git a/class.xorg.auth.php b/class.xorg.auth.php index 5fe2e08..0986afc 100644 --- a/class.xorg.auth.php +++ b/class.xorg.auth.php @@ -24,6 +24,7 @@ class xorgAuth extends dcAuth { $this->xorg_infos[$key] = $_SESSION['auth-xorg-' . $key]; } $this->user_id = $_SESSION['auth-xorg']; + parent::checkUser($this->user_id); } } @@ -64,6 +65,7 @@ class xorgAuth extends dcAuth { $cur->user_lang = 'fr'; $cur->user_name = $_SESSION['auth-xorg-nom']; $cur->user_firstname = $_SESSION['auth-xorg-prenom']; + $cur->user_displayname = $cur->user_firstname . ' ' . $cur->user_name; $cur->user_email = $_SESSION['auth-xorg'] . '@polytechnique.org'; $cur->user_options = $core->userDefaults(); $cur->user_default_blog = 'default'; // FIXME @@ -114,10 +116,7 @@ class xorgAuth extends dcAuth { } public function checkUser($user_id, $pwd = null, $user_key = null) { - if (!$this->callXorg() || $user_id != $this->user_id) { - return false; - } - return parent::checkUser($this->user_id); + return $this->callXorg(); } public function check($permissions, $blog_id) {