From 59007702c424aa052ee60bdcb5a0a7d32402b74f Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 25 Feb 2014 16:05:57 -0600
Subject: [PATCH] oops: Fix display of forgot-my-password link

Reported by @ntozier
---
 include/staff/login.tpl.php | 2 +-
 scp/login.php               | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/staff/login.tpl.php b/include/staff/login.tpl.php
index 1f3bb55e0..35fffcc98 100644
--- a/include/staff/login.tpl.php
+++ b/include/staff/login.tpl.php
@@ -12,7 +12,7 @@ $info = ($_POST && $errors)?Format::htmlchars($_POST):array();
             <input type="text" name="userid" id="name" value="<?php echo $info['userid']; ?>" placeholder="username" autocorrect="off" autocapitalize="off">
             <input type="password" name="passwd" id="pass" placeholder="password" autocorrect="off" autocapitalize="off">
         </fieldset>
-        <?php if ($_SESSION['_staff']['strikes'] > 1 && $cfg->allowPasswordReset()) { ?>
+        <?php if ($show_reset && $cfg->allowPasswordReset()) { ?>
         <h3 style="display:inline"><a href="pwreset.php">Forgot my password</a></h3>
         <?php } ?>
         <input class="submit" type="submit" name="submit" value="Log In">
diff --git a/scp/login.php b/scp/login.php
index 211bb7098..4356aaa61 100644
--- a/scp/login.php
+++ b/scp/login.php
@@ -23,6 +23,7 @@ $dest = $_SESSION['_staff']['auth']['dest'];
 $msg = $_SESSION['_staff']['auth']['msg'];
 $msg = $msg?$msg:'Authentication Required';
 $dest=($dest && (!strstr($dest,'login.php') && !strstr($dest,'ajax.php')))?$dest:'index.php';
+$show_reset = false;
 if($_POST) {
     // Lookup support backends for this staff
     $username = trim($_POST['userid']);
@@ -34,6 +35,7 @@ if($_POST) {
     }
 
     $msg = $errors['err']?$errors['err']:'Invalid login';
+    $show_reset = true;
 }
 // Consider single sign-on authentication backends
 else if (!$thisstaff || !($thisstaff->getId() || $thisstaff->isValid())) {
-- 
GitLab