JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Tweaked "Switch Login" page
authorJason Woofenden <jason@jasonwoof.com>
Wed, 14 Oct 2009 08:37:41 +0000 (04:37 -0400)
committerJason Woofenden <jason@jasonwoof.com>
Wed, 14 Oct 2009 08:37:41 +0000 (04:37 -0400)
* added display of login name
* added explanation
* added cancel button

su.html
su.php

diff --git a/su.html b/su.html
index 5e46932..919ae94 100644 (file)
--- a/su.html
+++ b/su.html
@@ -8,12 +8,16 @@
 
 <body>
   <!--~main_body start~-->
-  <h2>SU to be logged in as someone else</h2>
+  <h2>Switch Login</h2>
+
+  <p>With the links below you can quickly switch to being logged in under one of the client accounts. You will then see exactly what they see when they log in, and have exactly the same privileges to edit, etc. except that you are not prompted to fill out the tiny agreement and can still access this "Switch Login" page.</p>
 
   <!--~su_row start~-->
-    <p><a href="su?as=~client_id~">log in as ~client_name~</a></p>
+    <p><a href="su?as=~client_id~">log in as ~client_name.html~ (~client_username~)</a></p>
   <!--~end~-->
 
+  <p style="padding-top: 10px"><a href="./">Cancel</a></p>
+
 <!--~end~-->
 </body>
 </html>
diff --git a/su.php b/su.php
index 92b1b85..d777117 100644 (file)
--- a/su.php
+++ b/su.php
@@ -41,12 +41,13 @@ function _su_main() {
                return './';
        }
 
-       $rows = db_get_rows('people', 'id,name', 'order by name');
+       $rows = db_get_rows('people', 'id,name,username', 'order by name');
 
        if($rows) foreach($rows as $row) {
-               list($id, $name) = $row;
+               list($id, $name, $username) = $row;
                tem_set('client_id', $id);
                tem_set('client_name', $name);
+               tem_set('client_username', $username);
                tem_show('su_row');
        }
 }