]> git.joonet.de Git - adminer.git/commitdiff
Fix creating users and changing password in MySQL 8 (bug #663)
authorJakub Vrana <jakub@vrana.cz>
Mon, 28 Jan 2019 12:47:53 +0000 (13:47 +0100)
committerJakub Vrana <jakub@vrana.cz>
Mon, 28 Jan 2019 12:47:53 +0000 (13:47 +0100)
adminer/include/version.inc.php
adminer/user.inc.php
changes.txt

index 4c9cd02103a155dd560f60772a3767e35b09b09d..0d0af8ac192295c97bba9a174995593297ef9513 100644 (file)
@@ -1,2 +1,2 @@
 <?php
-$VERSION = "4.7.1";
+$VERSION = "4.7.2-dev";
index f456c1b6df72557a4e1b1227bda1b8ac92de9f4f..423db3b38d386680c3a30189d7f3216b52cd54b4 100644 (file)
@@ -52,7 +52,7 @@ if ($_POST && !$error) {
        } else {
                $new_user = q($_POST["user"]) . "@" . q($_POST["host"]); // if $_GET["host"] is not set then $new_user is always different
                $pass = $_POST["pass"];
-               if ($pass != '' && !$_POST["hashed"]) {
+               if ($pass != '' && !$_POST["hashed"] && !min_version(8)) {
                        // compute hash in a separate query so that plain text password is not saved to history
                        $pass = $connection->result("SELECT PASSWORD(" . q($pass) . ")");
                        $error = !$pass;
@@ -61,7 +61,7 @@ if ($_POST && !$error) {
                $created = false;
                if (!$error) {
                        if ($old_user != $new_user) {
-                               $created = queries((min_version(5) ? "CREATE USER" : "GRANT USAGE ON *.* TO") . " $new_user IDENTIFIED BY PASSWORD " . q($pass));
+                               $created = queries((min_version(5) ? "CREATE USER" : "GRANT USAGE ON *.* TO") . " $new_user IDENTIFIED BY " . (min_version(8) ? "" : "PASSWORD ") . q($pass));
                                $error = !$created;
                        } elseif ($pass != $old_pass) {
                                queries("SET PASSWORD FOR $new_user = " . q($pass));
@@ -136,7 +136,7 @@ if ($_POST) {
 <tr><th><?php echo lang('Username'); ?><td><input name="user" data-maxlength="80" value="<?php echo h($row["user"]); ?>" autocapitalize="off">
 <tr><th><?php echo lang('Password'); ?><td><input name="pass" id="pass" value="<?php echo h($row["pass"]); ?>" autocomplete="new-password">
 <?php if (!$row["hashed"]) { echo script("typePassword(qs('#pass'));"); } ?>
-<?php echo checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);"); ?>
+<?php echo (min_version(8) ? "" : checkbox("hashed", 1, $row["hashed"], lang('Hashed'), "typePassword(this.form['pass'], this.checked);")); ?>
 </table>
 
 <?php
index e12a493b07f3028cb8d3f263c167c0bba4474c70..81034969eff4bbfeb4165bf68183bbbb2301d56c 100644 (file)
@@ -1,3 +1,6 @@
+Adminer 4.7.2-dev:
+MySQL: Fix creating users and changing password in MySQL 8 (bug #663)
+
 Adminer 4.7.1 (released 2019-01-24):
 Display the tables scrollbar (bug #647)
 Remember visible columns in Create Table form (bug #493)