From 3c0fd3865497725e97d31981c4133d95bba42d13 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 3 Oct 2012 18:26:47 -0400
Subject: [PATCH] Retain entered username on error

---
 include/staff/login.tpl.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/staff/login.tpl.php b/include/staff/login.tpl.php
index b7fe6fe6e..b8b136eb5 100644
--- a/include/staff/login.tpl.php
+++ b/include/staff/login.tpl.php
@@ -1,4 +1,8 @@
-<?php defined('OSTSCPINC') or die('Invalid path'); ?>
+<?php 
+defined('OSTSCPINC') or die('Invalid path');
+
+$info = ($_POST && $errors)?Format::htmlchars($_POST):array();
+?>
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
@@ -24,7 +28,7 @@
         <?php csrf_token(); ?>
         <input type="hidden" name="do" value="scplogin">
         <fieldset>
-            <input type="text" name="username" id="name" value="" placeholder="username" autocorrect="off" autocapitalize="off">
+            <input type="text" name="username" id="name" value="<?php echo $info['username']; ?>" placeholder="username" autocorrect="off" autocapitalize="off">
             <input type="password" name="passwd" id="pass" placeholder="password" autocorrect="off" autocapitalize="off">
         </fieldset>
         <input class="submit" type="submit" name="submit" value="Log In">
-- 
GitLab