Overview
Comment: | Intégration de la préférence d'utilisation de HTTPS (ou non) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
fc7970d3769f863ecdefe4fec8483c7f |
User & Date: | bohwaz on 2015-12-09 12:42:50 |
Other Links: | manifest | tags |
Context
2015-12-09
| ||
12:47 | Un peu de couleur pour le cadenas, et un peu de régularisation des types check-in: ff010feb8b user: bohwaz tags: trunk, stable | |
12:42 | Intégration de la préférence d'utilisation de HTTPS (ou non) check-in: fc7970d376 user: bohwaz tags: trunk, stable | |
2015-12-08
| ||
18:48 | Je ne trouve plus de trace de à quoi sert ce hack à base de base64, et ça semble marcher sans, suppression pour fixer [3ea1a0bbc66d9f9bcfe0c6afad349f2d872ea83c] check-in: cc7ae49e57 user: bohwaz tags: trunk | |
Changes
Modified src/config.dist.php from [152c78f796] to [71b83249aa].
︙ | ︙ | |||
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | // (doit se terminer par un slash) // Défaut : découverte automatique à partir de SCRIPT_NAME const WWW_URI = '/garradin/'; // Adresse URL HTTP(S) de Garradin // Défaut : découverte à partir de HTTP_HOST ou SERVER_NAME + WWW_URI define('Garradin\WWW_URL', 'http://garradin.net' . WWW_URI); // Emplacement de stockage des plugins define('Garradin\PLUGINS_ROOT', DATA_ROOT . '/plugins'); // Plugins fixes qui ne peuvent être désinstallés (séparés par une virgule) const PLUGINS_SYSTEM = 'email,web'; | > > > > > > > > | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | // (doit se terminer par un slash) // Défaut : découverte automatique à partir de SCRIPT_NAME const WWW_URI = '/garradin/'; // Adresse URL HTTP(S) de Garradin // Défaut : découverte à partir de HTTP_HOST ou SERVER_NAME + WWW_URI define('Garradin\WWW_URL', 'http://garradin.net' . WWW_URI); // Doit-on suggérer à l'utilisateur d'utiliser la version chiffrée du site ? // 1 ou true = affiche un message de suggestion sur l'écran de connexion invitant à utiliser le site chiffré // (conseillé si vous avez un certificat auto-signé ou peu connu type CACert) // 2 = rediriger automatiquement sur la version chiffrée pour l'administration // 3 = rediriger automatiquement sur la version chiffrée pour administration et site public // false ou 0 = aucune version chiffrée disponible, donc ne rien proposer ni rediriger const PREFER_HTTPS = false; // Emplacement de stockage des plugins define('Garradin\PLUGINS_ROOT', DATA_ROOT . '/plugins'); // Plugins fixes qui ne peuvent être désinstallés (séparés par une virgule) const PLUGINS_SYSTEM = 'email,web'; |
︙ | ︙ |
Modified src/include/init.php from [de2c349764] to [ffaed97ada].
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | // Automagic URL discover $path = str_replace(ROOT . '/www', '', getcwd()); $path = str_replace($path, '', dirname($_SERVER['SCRIPT_NAME'])); $path = (!empty($path[0]) && $path[0] != '/') ? '/' . $path : $path; $path = (substr($path, -1) != '/') ? $path . '/' : $path; define('Garradin\WWW_URI', $path); } if (!defined('Garradin\WWW_URL')) { $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); define('Garradin\WWW_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://' . $host . WWW_URI); | > > > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | // Automagic URL discover $path = str_replace(ROOT . '/www', '', getcwd()); $path = str_replace($path, '', dirname($_SERVER['SCRIPT_NAME'])); $path = (!empty($path[0]) && $path[0] != '/') ? '/' . $path : $path; $path = (substr($path, -1) != '/') ? $path . '/' : $path; define('Garradin\WWW_URI', $path); } if (!defined('Garradin\PREFER_HTTPS')) { define('Garradin\PREFER_HTTPS', false); } if (!defined('Garradin\WWW_URL')) { $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); define('Garradin\WWW_URL', 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://' . $host . WWW_URI); |
︙ | ︙ |
Modified src/templates/admin/login.tpl from [67feecb2ab] to [e5872508d1].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | {include file="admin/_head.tpl" title="Connexion"} {if $error} <p class="error"> {if $error == 'OTHER'} Une erreur est survenue, merci de réessayer. {else} Connexion impossible. Vérifiez l'adresse e-mail et le mot de passe. {/if} </p> {/if} <form method="post" action="{$self_url|escape}"> <fieldset> <legend>Connexion</legend> <dl> <dt><label for="f_id">{$champ.title}</label></dt> <dd><input type="text" name="id" id="f_id" value="{form_field name=id}" /></dd> <dt><label for="f_passe">Mot de passe</label></dt> | > > > > > > > > | > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | {include file="admin/_head.tpl" title="Connexion"} {if $error} <p class="error"> {if $error == 'OTHER'} Une erreur est survenue, merci de réessayer. {else} Connexion impossible. Vérifiez l'adresse e-mail et le mot de passe. {/if} </p> {/if} {if !$ssl_enabled && $prefer_ssl} <p class="alert"> <strong>Message de sécurité</strong><br /> Nous vous conseillons de vous connecter sur la version <a href="{$own_https_url}">chiffrée (HTTPS) de cette page</a> pour vous connecter. </p> {/if} <form method="post" action="{$self_url|escape}"> <fieldset> <legend>Connexion</legend> <dl> <dt><label for="f_id">{$champ.title}</label></dt> <dd><input type="text" name="id" id="f_id" value="{form_field name=id}" /></dd> <dt><label for="f_passe">Mot de passe</label></dt> <dd><input type="password" name="passe" id="f_passe" value="" /> {if $ssl_enabled} <b class="icn" title="Connexion chiffrée">🔒</b> <span class="confirm">Connexion sécurisée</span> {else} <b class="icn" title="Connexion non chiffrée">🔓</b> {if $prefer_ssl} <span class="error">Connexion non-sécurisée&nbps;!</span> <a href="{$own_https_url}">Se connecter en HTTPS (sécurisé)</a> {else} <span class="alert">Connexion non-sécurisée</span> {/if} {/if} </dd> </dl> </fieldset> <p class="submit"> {csrf_field key="login"} <input type="submit" name="login" value="Se connecter →" /> </p> |
︙ | ︙ |
Modified src/www/admin/_inc.php from [6bf7160f0b] to [9d5487ab7c].
1 2 3 4 5 6 7 8 9 10 11 12 | <?php namespace Garradin; require_once __DIR__ . '/../../include/init.php'; $tpl = Template::getInstance(); $tpl->assign('admin_url', WWW_URL . 'admin/'); $membres = new Membres; if (!defined('Garradin\LOGIN_PROCESS')) | > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php namespace Garradin; require_once __DIR__ . '/../../include/init.php'; // Redirection automatique en HTTPS si nécessaire if (PREFER_HTTPS >= 2 && empty($_SERVER['HTTPS'])) { utils::redirect(str_replace('http://', 'https://', WWW_URL)); exit; } $tpl = Template::getInstance(); $tpl->assign('admin_url', WWW_URL . 'admin/'); $membres = new Membres; if (!defined('Garradin\LOGIN_PROCESS')) |
︙ | ︙ | |||
25 26 27 28 29 30 31 | $tpl->assign('plugins_menu', Plugin::listMenu()); if ($user['droits']['membres'] >= Membres::DROIT_ACCES) { $tpl->assign('nb_membres', $membres->countAllButHidden()); } } | < < | 32 33 34 35 36 37 38 | $tpl->assign('plugins_menu', Plugin::listMenu()); if ($user['droits']['membres'] >= Membres::DROIT_ACCES) { $tpl->assign('nb_membres', $membres->countAllButHidden()); } } |
Modified src/www/admin/login.php from [6a3ca32fc8] to [21842de4e9].
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 | } } $champs = $config->get('champs_membres'); $champ = $champs->get($config->get('champ_identifiant')); $tpl->assign('champ', $champ); $tpl->assign('error', $error); $tpl->display('admin/login.tpl'); | > > > > < < | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | } } $champs = $config->get('champs_membres'); $champ = $champs->get($config->get('champ_identifiant')); $tpl->assign('ssl_enabled', empty($_SERVER['HTTPS']) ? false : true); $tpl->assign('prefer_ssl', PREFER_HTTPS); $tpl->assign('own_https_url', str_replace('http://', 'https://', utils::getSelfURL())); $tpl->assign('champ', $champ); $tpl->assign('error', $error); $tpl->display('admin/login.tpl'); |