Overview
Comment: | Improve login form messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA1: |
cb81b4f7434f008d9008201a11c539c4 |
User & Date: | bohwaz on 2020-11-08 03:24:06 |
Other Links: | branch diff | manifest | tags |
Context
2020-11-08
| ||
03:24 | Fix install and other forms with passwords check-in: 14966850df user: bohwaz tags: dev | |
03:24 | Improve login form messages check-in: cb81b4f743 user: bohwaz tags: dev | |
02:11 | Implement list of transactions linked to a service check-in: 54b9d03a1c user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Template.php from [0dc1ec7995] to [946dddaa81].
︙ | ︙ | |||
135 136 137 138 139 140 141 | $form = $this->getTemplateVars('form'); if (!$form->hasErrors()) { return ''; } | > > > > | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | $form = $this->getTemplateVars('form'); if (!$form->hasErrors()) { return ''; } $errors = $form->getErrorMessages(!empty($params['membre']) ? true : false); $errors = array_map([$this, 'escape'], $errors); $errors = array_map('nl2br', $errors); return '<div class="block error"><ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>'; } protected function showError($params) { if (!$params['if']) { return ''; |
︙ | ︙ |
Modified src/templates/admin/login.tpl from [bfb4d0b3a6] to [07fd7dea03].
1 2 3 | {include file="admin/_head.tpl" title="Connexion" js=1} {form_errors} | < | 1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Connexion" js=1} {form_errors} {if $changed} <p class="block confirm"> Votre mot de passe a bien été modifié.<br /> Vous pouvez maintenant l'utiliser pour vous reconnecter. </p> {/if} |
︙ | ︙ | |||
19 20 21 22 23 24 25 | {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Connexion</legend> <dl> | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | {/if} <form method="post" action="{$self_url}"> <fieldset> <legend>Connexion</legend> <dl> <dt><label for="f_id">{$id_field_name}</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="password" id="f_passe" value="" autocomplete="current-password" /> {if $ssl_enabled} <b class="icn confirm" title="Connexion chiffrée">🔒</b> <span class="confirm">Connexion sécurisée</span> {else} <b class="icn error" title="Connexion non chiffrée">🔓</b> {if $prefer_ssl} <span class="error">Connexion non-sécurisée !</span> |
︙ | ︙ |
Modified src/www/admin/login.php from [3ef470efd1] to [10a6843bd1].
︙ | ︙ | |||
21 22 23 24 25 26 27 | header('Content-Type: image/gif'); echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="); exit; } | | | | < | | | < < < > | < | < > > | | < > | < > < > | < | 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 50 51 52 53 54 55 | header('Content-Type: image/gif'); echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="); exit; } $champs = $config->get('champs_membres'); $id_field = (object) $champs->get($config->get('champ_identifiant')); $id_field_name = $id_field->title; $form->runIf('login', function () use ($id_field_name, $session) { if (!trim(f('_id'))) { throw new UserException(sprintf('L\'identifiant (%s) n\'a pas été renseigné.', $id_field_name)); } if (!trim(f('password'))) { throw new UserException('Le mot de passe n\'a pas été renseigné.'); } if (!$session->login(f('_id'), f('password'), (bool) f('permanent'))) { throw new UserException(sprintf("Connexion impossible.\nVérifiez votre identifiant (%s) et votre mot de passe.", $id_field_name)); } }, 'login', ADMIN_URL); $session->cleanOldCookies(); $tpl->assign('ssl_enabled', empty($_SERVER['HTTPS']) ? false : true); $tpl->assign('prefer_ssl', (bool)PREFER_HTTPS); $tpl->assign('own_https_url', str_replace('http://', 'https://', utils::getSelfURL())); $tpl->assign(compact('id_field_name')); $tpl->assign('changed', qg('changed') !== null); $tpl->display('admin/login.tpl'); |