From 7a33661b721714a8b266bf57c0065ae653bb8097 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Wed, 1 Jun 2016 09:57:17 -0700 Subject: [PATCH] SQLite: Require credentials to use (thanks to Vincent Waart) --- adminer/include/adminer.inc.php | 12 +++++++----- adminer/include/auth.inc.php | 4 ++-- adminer/lang/cs.inc.php | 1 + adminer/lang/xx.inc.php | 1 + adminer/static/editing.js | 12 ------------ changes.txt | 1 + 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 05694fda..4b861248 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -88,16 +88,14 @@ class Adminer { global $drivers; ?> -
+
" autocapitalize="off">
" autocapitalize="off">
\n"; @@ -107,9 +105,13 @@ username.form['auth[driver]'].onchange(); /** Authorize the user * @param string * @param string - * @return bool + * @return mixed true for success, string for error message, false for unknown error */ function login($login, $password) { + global $jush; + if ($jush == "sqlite") { + return lang('Implement %s method to use SQLite.', 'login()'); + } return true; } diff --git a/adminer/include/auth.inc.php b/adminer/include/auth.inc.php index 5bd79f9c..8f48c2c6 100644 --- a/adminer/include/auth.inc.php +++ b/adminer/include/auth.inc.php @@ -167,8 +167,8 @@ if (isset($_GET["username"])) { $driver = new Min_Driver($connection); -if (!is_object($connection) || !$adminer->login($_GET["username"], get_password())) { - auth_error((is_string($connection) ? $connection : lang('Invalid credentials.'))); +if (!is_object($connection) || ($login = $adminer->login($_GET["username"], get_password())) !== true) { + auth_error((is_string($connection) ? $connection : (is_string($login) ? $login : lang('Invalid credentials.')))); } if ($auth && $_POST["token"]) { diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 03e8f668..09c80066 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -11,6 +11,7 @@ $translations = array( 'Logged as: %s' => 'Přihlášen jako: %s', 'Logout successful.' => 'Odhlášení proběhlo v pořádku.', 'Invalid credentials.' => 'Neplatné přihlašovací údaje.', + 'Implement %s method to use SQLite.' => 'Pro přihlášení k SQLite implementujte metodu %s.', 'Too many unsuccessful logins, try again in %d minute(s).' => array('Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minutu.', 'Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minuty.', 'Příliš mnoho pokusů o přihlášení, zkuste to znovu za %d minut.'), 'Master password expired. Implement %s method to make it permanent.' => 'Platnost hlavního hesla vypršela. Implementujte metodu %s, aby platilo stále.', 'Language' => 'Jazyk', diff --git a/adminer/lang/xx.inc.php b/adminer/lang/xx.inc.php index ddb7d74d..65d64354 100644 --- a/adminer/lang/xx.inc.php +++ b/adminer/lang/xx.inc.php @@ -11,6 +11,7 @@ $translations = array( 'Logged as: %s' => 'Xx', 'Logout successful.' => 'Xx.', 'Invalid credentials.' => 'Xx.', + 'Implement %s method to use SQLite.' => 'Xx.', 'Too many unsuccessful logins, try again in %d minute(s).' => array('Xx.', 'Xx.'), 'Master password expired. Implement %s method to make it permanent.' => 'Xx.', 'Language' => 'Xx', diff --git a/adminer/static/editing.js b/adminer/static/editing.js index b07d2c20..f0ce0e34 100644 --- a/adminer/static/editing.js +++ b/adminer/static/editing.js @@ -60,18 +60,6 @@ function typePassword(el, disable) { } } -/** Hide or show some login rows for selected driver -* @param HTMLSelectElement -*/ -function loginDriver(driver) { - var trs = parentTag(driver, 'table').rows; - for (var i=1; i < trs.length - 1; i++) { - var disabled = /sqlite/.test(driver.value); - alterClass(trs[i], 'hidden', disabled); - trs[i].getElementsByTagName('input')[0].disabled = disabled; - } -} - var dbCtrl; diff --git a/changes.txt b/changes.txt index a073a70a..3011a08a 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ Adminer 4.2.5-dev: Fix remote execution in SQLite query +SQLite: Require credentials to use PostgreSQL: Support KILL Adminer 4.2.4 (released 2016-02-06):