Fixed: invalid smartform input to Admin:UserManager when errors present and changing own account; [demo mode] default user can no longer change password
authorDan
Fri, 02 Nov 2007 15:38:20 -0400
changeset 224 6a4573507ff8
parent 223 8877bbfccc38
child 225 b9a8a993f4e7
child 230 3daa715e0f69
Fixed: invalid smartform input to Admin:UserManager when errors present and changing own account; [demo mode] default user can no longer change password
plugins/SpecialUserPrefs.php
plugins/admin/UserManager.php
--- a/plugins/SpecialUserPrefs.php	Thu Nov 01 15:13:27 2007 -0400
+++ b/plugins/SpecialUserPrefs.php	Fri Nov 02 15:38:20 2007 -0400
@@ -212,6 +212,8 @@
           
           if ( strlen($newpass) > 0 )
           {
+            if ( defined('ENANO_DEMO_MODE') )
+              $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">You can\'t change your password in demo mode.</div>';
             // Perform checks
             if ( strlen($newpass) < 6 )
               $errors .= '<div class="error-box" style="margin: 0 0 10px 0;">Password must be at least 6 characters. You hacked my script, darn you!</div>';
--- a/plugins/admin/UserManager.php	Thu Nov 01 15:13:27 2007 -0400
+++ b/plugins/admin/UserManager.php	Fri Nov 02 15:38:20 2007 -0400
@@ -52,7 +52,14 @@
     }
     else
     {
-      if ( $session->user_id != $user_id )
+      if ( $session->user_id == $user_id )
+      {
+        $username = $session->username;
+        $password = false;
+        $email = $session->email;
+        $real_name = $session->real_name;
+      }
+      else
       {
         $username = $_POST['username'];
         if ( !preg_match('#^'.$session->valid_username.'$#', $username) )