From: Stéphane Jacob Date: Mon, 14 Mar 2011 21:41:51 +0000 (+0100) Subject: Adds login page for xnet users (Closes #1211). X-Git-Tag: xorg/1.1.0~26^2~22 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=3c64137d24e5e864c608442ade2c49dc5710b9f1;p=platal.git Adds login page for xnet users (Closes #1211). Signed-off-by: Stéphane Jacob --- diff --git a/ChangeLog b/ChangeLog index 53e5758..62fb6e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,6 +28,9 @@ Bug/Wish: - #1389: Do not require validation for private names modifications -JAC - #1401: Main addresses are displayed before secondary addresses -JAC + * Xnet: + - #1211: Adds login page for xnet users -JAC + * XnetGrp: - #907: Adds more info about groups (address, phones, positions) -JAC diff --git a/classes/xnetsession.php b/classes/xnetsession.php index 2833d32..90cf11c 100644 --- a/classes/xnetsession.php +++ b/classes/xnetsession.php @@ -34,6 +34,25 @@ class XnetSession extends XorgSession } } + if (!S::logged() && Post::has('auth_type') && Post::v('auth_type') == 'xnet') { + $type = XDB::fetchOneCell('SELECT type + FROM accounts + WHERE hruid = {?}', + Post::v('username')); + if (!is_null($type) && $type != 'xnet') { + Platal::page()->trigErrorRedirect('Ce formulaire d\'authentification est réservé aux extérieurs à la communauté polytechnicienne.', ''); + } + + $user = parent::doAuth(AUTH_MDP); + if (is_null($user)) { + return false; + } + if (!parent::checkAuth(AUTH_MDP) || !parent::startSessionAs($user, AUTH_MDP)) { + $this->destroy(); + return false; + } + } + global $globals; if (!S::logged() && $globals->xnet->auth_baseurl) { // prevent connection to be linked to disconnection diff --git a/include/xnet.inc.php b/include/xnet.inc.php index a57e421..a2d1c22 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -26,6 +26,7 @@ define('PL_SESSION_CLASS', 'XnetSession'); define('PL_PAGE_CLASS', 'XnetPage'); require_once dirname(dirname(__FILE__)) . '/core/include/platal.inc.php'; +require_once 'security.inc.php'; require_once 'common.inc.php'; // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/modules/xnet.php b/modules/xnet.php index e0b5f00..627824c 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -33,6 +33,7 @@ class XnetModule extends PLModule 'plan' => $this->make_hook('plan', AUTH_PUBLIC), 'photo' => $this->make_hook('photo', AUTH_MDP), 'autologin' => $this->make_hook('autologin', AUTH_MDP), + 'login/ext' => $this->make_hook('login_ext', AUTH_PUBLIC), 'edit' => $this->make_hook('edit', AUTH_MDP, 'user'), 'Xnet' => $this->make_wiki_hook(), @@ -225,6 +226,15 @@ class XnetModule extends PLModule exit; } + function handler_login_ext($page) + { + if (!S::logged()) { + $page->changeTpl('xnet/login.tpl'); + } else { + pl_redirect(''); + } + } + function handler_edit(&$page) { global $globals; diff --git a/templates/xnet/login.tpl b/templates/xnet/login.tpl new file mode 100644 index 0000000..f92b8cb --- /dev/null +++ b/templates/xnet/login.tpl @@ -0,0 +1,64 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2011 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + +

Identification

+ +
+ + + + + + + + + + + + + + + +
Identifiant : + + +
Mot de passe :
strictement personnelle'} colspan="2"> + +
+
+ +
+
+ + + + + + + +
+
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/xnet/skin.tpl b/templates/xnet/skin.tpl index 05cb391..b395e5e 100644 --- a/templates/xnet/skin.tpl +++ b/templates/xnet/skin.tpl @@ -169,10 +169,16 @@ {list_all_my_groups} {if !$smarty.session.auth}
Me connecter :
- polytechnicien - {if $platal->pl_self() neq 'exit'} - - {/if} + + + + + + + +
+ X, masters, doctorants… +
Extérieurs
{/if}