]> git.joonet.de Git - adminer.git/commitdiff
Login: Fix hiding server with AdminerLoginServers
authorJakub Vrana <jakub@vrana.cz>
Tue, 1 Apr 2025 16:27:04 +0000 (18:27 +0200)
committerJakub Vrana <jakub@vrana.cz>
Tue, 1 Apr 2025 16:27:04 +0000 (18:27 +0200)
adminer/include/adminer.inc.php
compile.php

index d81a3a7172eb7c3aea6b9182523978471e51b20e..b21ae6732020280c4487eea4fd0e07210890b102 100644 (file)
@@ -125,7 +125,7 @@ class Adminer {
                echo adminer()->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", SqlDriver::$drivers, DRIVER, "loginDriver(this);"));
                echo adminer()->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name="auth[server]" value="' . h(SERVER) . '" title="hostname[:port]" placeholder="localhost" autocapitalize="off">');
                // this is matched by compile.php
-               echo adminer()->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" autofocus value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("qs('#username').form['auth[driver]'].onchange();"));
+               echo adminer()->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" autofocus value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("const authDriver = qs('#username').form['auth[driver]']; authDriver && authDriver.onchange();"));
                echo adminer()->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">');
                echo adminer()->loginFormField('db', '<tr><th>' . lang('Database') . '<td>', '<input name="auth[db]" value="' . h($_GET["db"]) . '" autocapitalize="off">');
                echo "</table>\n";
index 8948c2470d1852eb66290ece985d8ca2942d3f43..53c2ac380ad043c79ac15cada724782acff2c140 100755 (executable)
@@ -316,7 +316,7 @@ if ($vendor) {
                if (!$count) {
                        echo "auth[driver] form field not found\n";
                }
-               $file = str_replace(" . script(\"qs('#username').form['auth[driver]'].onchange();\")", "", $file);
+               $file = str_replace(" . script(\"const authDriver = qs('#username').form['auth[driver]']; authDriver && authDriver.onchange();\")", "", $file);
                if ($vendor == "sqlite") {
                        $file = str_replace(");\n\t\techo \$this->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name=\"auth[server]", ' . \'<input type="hidden" name="auth[server]"', $file);
                }