SQLite: Hide server field in login form

This commit is contained in:
Jakub Vrana 2019-01-16 14:57:21 +01:00
parent 2117f224b6
commit 2cb426b464
3 changed files with 15 additions and 2 deletions

View file

@ -119,9 +119,9 @@ class Adminer {
function loginForm() {
global $drivers;
echo "<table cellspacing='0' class='layout'>\n";
echo $this->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", $drivers, DRIVER) . "\n");
echo $this->loginFormField('driver', '<tr><th>' . lang('System') . '<td>', html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);") . "\n");
echo $this->loginFormField('server', '<tr><th>' . lang('Server') . '<td>', '<input name="auth[server]" value="' . h(SERVER) . '" title="hostname[:port]" placeholder="localhost" autocapitalize="off">' . "\n");
echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("focus(qs('#username'));"));
echo $this->loginFormField('username', '<tr><th>' . lang('Username') . '<td>', '<input name="auth[username]" id="username" value="' . h($_GET["username"]) . '" autocomplete="username" autocapitalize="off">' . script("focus(qs('#username')); qs('#username').form['auth[driver]'].onchange();"));
echo $this->loginFormField('password', '<tr><th>' . lang('Password') . '<td>', '<input type="password" name="auth[password]" autocomplete="current-password">' . "\n");
echo $this->loginFormField('db', '<tr><th>' . lang('Database') . '<td>', '<input name="auth[db]" value="' . h($_GET["db"]) . '" autocapitalize="off">' . "\n");
echo "</table>\n";

View file

@ -82,6 +82,18 @@ function messagesPrint() {
/** Hide or show some login rows for selected driver
* @param HTMLSelectElement
*/
function loginDriver(driver) {
var trs = parentTag(driver, 'table').rows;
var disabled = /sqlite/.test(selectValue(driver));
alterClass(trs[1], 'hidden', disabled); // 1 - row with server
trs[1].getElementsByTagName('input')[0].disabled = disabled;
}
var dbCtrl;
var dbPrevious = {};

View file

@ -2,6 +2,7 @@ Adminer 4.7.1-dev:
Display the tables scrollbar (bug #647)
Add autocomplete attributes to login form
PHP <5.4 compatibility even with ClickHouse enabled (regression from 4.7.0)
SQLite: Hide server field in login form
Adminer 4.7.0 (released 2018-11-24):
Simplify storing executed SQL queries to bookmarks