From ec6eab207a7df33258f2ff2657bbbf1bcc7a863a Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Mon, 7 Feb 2005 01:08:29 +0000 Subject: [PATCH] cookie and login no more forget/remember on preferences.php now, all is directed from : * the checkbox * the deconnexion link make a warning with overlib to please JMY git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-452 --- ChangeLog | 3 +++ hooks/tmp.inc.php | 1 - htdocs/deconnexion.php | 6 ++++++ htdocs/preferences.php | 17 ----------------- include/xorg/menu.inc.php | 2 ++ templates/password_prompt.tpl | 5 +++-- templates/password_prompt_logged.tpl | 5 +++-- templates/preferences.tpl | 17 ----------------- 8 files changed, 17 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ec8528..d3d903f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ VERSION 0.9.5 24 Jan 2004 New : + * Core : + - Improve login/exit wrt cookie. -Mad + * Fiche : - A public fiche is now available for visiters. -Car diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index db9ccbf..56da19b 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -3,7 +3,6 @@ function tmp_menu() { global $globals; - $globals->menu->addPrivateEntry(XOM_NO, 10, 'Page d\'accueil', 'login.php'); $globals->menu->addPrivateEntry(XOM_CUSTOM, 10, 'Mon profil', 'profil.php'); $globals->menu->addPrivateEntry(XOM_CUSTOM, 20, 'Mes contacts', 'carnet/mescontacts.php'); diff --git a/htdocs/deconnexion.php b/htdocs/deconnexion.php index 49f29f9..af31abc 100644 --- a/htdocs/deconnexion.php +++ b/htdocs/deconnexion.php @@ -23,6 +23,12 @@ require_once('xorg.inc.php'); if (isset($_SESSION['suid'])) { require_once('./exit.php'); } +if (Get::has('forget')) { + setcookie('ORGaccess', '', time() - 3600, '/', '', 0); + Cookie::kill('ORGaccess'); + $_SESSION['log']->log("cookie_off"); +} + if (isset($_SESSION['log'])) { $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $_SESSION['log']->log('deconnexion',$ref); diff --git a/htdocs/preferences.php b/htdocs/preferences.php index d1659e4..8d38ab9 100644 --- a/htdocs/preferences.php +++ b/htdocs/preferences.php @@ -22,23 +22,6 @@ require_once("xorg.inc.php"); new_skinned_page('preferences.tpl', AUTH_COOKIE); -if (Env::has('remember')) { - setcookie('ORGaccess', md5(Session::get('password')), (time()+25920000), '/', '' ,0); - $_SESSION['log']->log('cookie_on'); - header('Location: preferences.php'); -} - -if (Env::has('forget')) { - setcookie('ORGaccess', '', time() - 3600, '/', '', 0); - $_SESSION['log']->log("cookie_off"); - if (!identified()) { - session_destroy(); - $_SESSION = array(); - header('Location: index.php'); - } - header('Location: preferences.php'); -} - if (Env::has('mail_fmt')) { $fmt=Env::get('mail_fmt'); if ($fmt != 'texte') $fmt = 'html'; diff --git a/include/xorg/menu.inc.php b/include/xorg/menu.inc.php index bbfdd37..b07b2cd 100644 --- a/include/xorg/menu.inc.php +++ b/include/xorg/menu.inc.php @@ -94,6 +94,8 @@ class XOrgMenu $res = logged() ? $this->_int : $this->_ext; if (identified()) { $res[XOM_NO][] = Array(0, 'text' => 'Déconnexion', 'url' => 'deconnexion.php'); + } elseif (Cookie::has('ORGaccess')) { + $res[XOM_NO][] = Array(0, 'text' => 'Oublier la connexion', 'url' => 'deconnexion.php?forget=1'); } if (!has_perms()) { unset($res[XOM_ADMIN]); diff --git a/templates/password_prompt.tpl b/templates/password_prompt.tpl index 5209021..d6eafae 100644 --- a/templates/password_prompt.tpl +++ b/templates/password_prompt.tpl @@ -89,8 +89,9 @@ Si tu n'es pas {insert name="getName"}, change le login ci-dessous, ou rends-toi - - Se souvenir de moi + + Etablir une connexion permanente diff --git a/templates/password_prompt_logged.tpl b/templates/password_prompt_logged.tpl index a4c59a3..7b161cd 100644 --- a/templates/password_prompt_logged.tpl +++ b/templates/password_prompt_logged.tpl @@ -49,8 +49,9 @@ - - Se souvenir de moi + + Etablir une connexion permanente diff --git a/templates/preferences.tpl b/templates/preferences.tpl index f555359..f5bbc33 100644 --- a/templates/preferences.tpl +++ b/templates/preferences.tpl @@ -69,23 +69,6 @@ - - - {if $smarty.cookies.ORGaccess} -

M'oublier

-
- Clique sur le lien ci-dessus pour retirer l'accès sans mot de passe au site. Après avoir - cliqué, tu devras entrer ton mot de passe pour accéder aux différentes pages. -
- {else} -

Se souvenir de moi

-
- Cette option te permet de ne plus avoir à entrer ton mot de passe pour la majorité des pages du site. - Il s'agit d'une option destinée aux utilisateurs fréquents du site, et pour un ordinateur non partagé. -
- {/if} - - {* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4