Encode password with new users' login
authorJoey Schulze <joey@infodrom.org>
Mon, 8 Mar 2010 08:01:43 +0000 (09:01 +0100)
committerJoey Schulze <joey@infodrom.org>
Mon, 8 Mar 2010 08:01:43 +0000 (09:01 +0100)
ajax/ajax.php

index 6597a76..213160a 100644 (file)
@@ -108,7 +108,9 @@ function save($mask)
        $update[] = sprintf("%s=%s", $field, format_decimal($_POST[$field]));
     } elseif ($info['type'] == 'passwd') {
       if (!empty($_POST[$field]))
-       $update[] = sprintf("%s='%s'", $field, pg_escape_string(passwd($_SESSION['sys']['login'],$_POST[$field])));
+       $update[] = sprintf("%s='%s'", $field,
+                           pg_escape_string(passwd(empty($_POST['login'])?$_SESSION['sys']['login']:$_POST['login'],
+                                                   $_POST[$field])));
     } else {
       if (empty($_POST[$field]) && $info['null'] === true)
         $update[] = sprintf("%s=NULL", $field);