From dbcd06e988d8434f125b8a5ee8f5bbcb7cd87874 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 6 May 2016 19:58:19 +0200 Subject: Reindent the login template --- tpl/loginform.html | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/tpl/loginform.html b/tpl/loginform.html index 678375fd..f0b45df2 100644 --- a/tpl/loginform.html +++ b/tpl/loginform.html @@ -1,26 +1,27 @@ {include="includes"} - + {include="page.footer"} -- cgit v1.2.3 From 85c4bdc23581b91971315c42508c2d8f7a5fa738 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 6 May 2016 20:03:10 +0200 Subject: Prefill the login field when the authentication has failed --- index.php | 7 +++++-- tpl/loginform.html | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 47bae6e8..dd876a66 100644 --- a/index.php +++ b/index.php @@ -495,9 +495,9 @@ if (isset($_POST['login'])) else { ban_loginFailed(); - $redir = ''; + $redir = '&username='. $_POST['login']; if (isset($_GET['post'])) { - $redir = '?post=' . urlencode($_GET['post']); + $redir .= '&post=' . urlencode($_GET['post']); foreach (array('description', 'source', 'title') as $param) { if (!empty($_GET[$param])) { $redir .= '&' . $param . '=' . urlencode($_GET[$param]); @@ -943,6 +943,9 @@ function renderPage() if ($GLOBALS['config']['OPEN_SHAARLI']) { header('Location: ?'); exit; } // No need to login for open Shaarli $token=''; if (ban_canLogin()) $token=getToken(); // Do not waste token generation if not useful. $PAGE->assign('token',$token); + if (isset($_GET['username'])) { + $PAGE->assign('username', escape($_GET['username'])); + } $PAGE->assign('returnurl',(isset($_SERVER['HTTP_REFERER']) ? escape($_SERVER['HTTP_REFERER']):'')); $PAGE->renderPage('loginform'); exit; diff --git a/tpl/loginform.html b/tpl/loginform.html index f0b45df2..a49b42d3 100644 --- a/tpl/loginform.html +++ b/tpl/loginform.html @@ -2,7 +2,13 @@ {include="includes"} +{if="ban_canLogin()"} + {if="empty($username)"} + onload="document.loginform.login.focus();" + {else} + onload="document.loginform.password.focus();" + {/if} +{/if}>