Browse Source

Fix #16: add back button to login flow that redirects to username entry

master
Skylar Ittner 5 months ago
parent
commit
922ea55cdb
4 changed files with 14 additions and 1 deletions
  1. 2
    1
      langs/en/login.json
  2. 6
    0
      login/index.php
  3. 3
    0
      login/parts/password.php
  4. 3
    0
      login/parts/totp.php

+ 2
- 1
langs/en/login.json View File

@@ -21,5 +21,6 @@
21 21
     "account locked": "This account has been disabled. Contact technical support.",
22 22
     "password expired": "You must change your password before continuing.",
23 23
     "account terminated": "Account terminated.  Access denied.",
24
-    "account state error": "Your account state is not stable.  Log out, restart your browser, and try again."
24
+    "account state error": "Your account state is not stable.  Log out, restart your browser, and try again.",
25
+    "Back": "Back"
25 26
 }

+ 6
- 0
login/index.php View File

@@ -29,6 +29,12 @@ if (empty($_SESSION['thisstep'])) {
29 29
     $_SESSION['thisstep'] = "username";
30 30
 }
31 31
 
32
+if (!empty($_GET['reset'])) {
33
+    $_SESSION['thisstep'] = "username";
34
+    $_SESSION['check'] = "";
35
+    header("Location: ./?code=$_GET[code]&redirect=$_GET[redirect]");
36
+}
37
+
32 38
 $error = "";
33 39
 
34 40
 function sendUserBack($code, $url, $uid) {

+ 3
- 0
login/parts/password.php View File

@@ -22,6 +22,9 @@ $username = (new User($_SESSION['login_uid']))->getUsername();
22 22
     </div>
23 23
 
24 24
     <div class="d-flex">
25
+        <a href="./?code=<?php echo htmlentities($_GET['code']); ?>&amp;redirect=<?php echo htmlentities($_GET['redirect']); ?>&amp;reset=1" class="btn btn-link mr-2">
26
+            <i class="fas fa-chevron-left"></i> <?php $Strings->get("Back"); ?>
27
+        </a>
25 28
         <button type="submit" class="btn btn-primary ml-auto">
26 29
             <i class="fas fa-chevron-right"></i> <?php $Strings->get("continue"); ?>
27 30
         </button>

+ 3
- 0
login/parts/totp.php View File

@@ -21,6 +21,9 @@ $_SESSION['check'] = "totp";
21 21
     </div>
22 22
 
23 23
     <div class="d-flex">
24
+        <a href="./?code=<?php echo htmlentities($_GET['code']); ?>&amp;redirect=<?php echo htmlentities($_GET['redirect']); ?>&amp;reset=1" class="btn btn-link mr-2">
25
+            <i class="fas fa-chevron-left"></i> <?php $Strings->get("Back"); ?>
26
+        </a>
24 27
         <button type="submit" class="btn btn-primary ml-auto">
25 28
             <i class="fas fa-chevron-right"></i> <?php $Strings->get("continue"); ?>
26 29
         </button>

Loading…
Cancel
Save