]> git.joonet.de Git - adminer.git/commitdiff
SQLite: Require credentials to use (thanks to Vincent Waart)
authorJakub Vrana <jakub@vrana.cz>
Wed, 1 Jun 2016 16:57:17 +0000 (09:57 -0700)
committerJakub Vrana <jakub@vrana.cz>
Wed, 1 Jun 2016 16:59:20 +0000 (09:59 -0700)
adminer/include/adminer.inc.php
adminer/include/auth.inc.php
adminer/lang/cs.inc.php
adminer/lang/xx.inc.php
adminer/static/editing.js
changes.txt

index 05694fda8c5661f39a9c8b89fd8dbde0c4148481..4b861248e8d0917256984ee2a34087adf7045f27 100644 (file)
@@ -88,16 +88,14 @@ class Adminer {
                global $drivers;
                ?>
 <table cellspacing="0">
-<tr><th><?php echo lang('System'); ?><td><?php echo html_select("auth[driver]", $drivers, DRIVER, "loginDriver(this);"); ?>
+<tr><th><?php echo lang('System'); ?><td><?php echo html_select("auth[driver]", $drivers, DRIVER); ?>
 <tr><th><?php echo lang('Server'); ?><td><input name="auth[server]" value="<?php echo h(SERVER); ?>" title="hostname[:port]" placeholder="localhost" autocapitalize="off">
 <tr><th><?php echo lang('Username'); ?><td><input name="auth[username]" id="username" value="<?php echo h($_GET["username"]); ?>" autocapitalize="off">
 <tr><th><?php echo lang('Password'); ?><td><input type="password" name="auth[password]">
 <tr><th><?php echo lang('Database'); ?><td><input name="auth[db]" value="<?php echo h($_GET["db"]); ?>" autocapitalize="off">
 </table>
 <script type="text/javascript">
-var username = document.getElementById('username');
-focus(username);
-username.form['auth[driver]'].onchange();
+focus(document.getElementById('username'));
 </script>
 <?php
                echo "<p><input type='submit' value='" . lang('Login') . "'>\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;
        }
 
index 5bd79f9ca2f9c552bd88b0899a7aff843b7946e1..8f48c2c6db18f85e09fe2f529044e2535cce0654 100644 (file)
@@ -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"]) {
index 03e8f668fa78991f51149fa8a40c8f2c6447af6a..09c800663e3c65c5e840f1ec463dc46879de990d 100644 (file)
@@ -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. <a href="https://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.' => 'Platnost hlavního hesla vypršela. <a href="https://www.adminer.org/cs/extension/" target="_blank">Implementujte</a> metodu %s, aby platilo stále.',
        'Language' => 'Jazyk',
index ddb7d74dedd51d902870ff40a70d8e43e6487e99..65d643546ab8a6f6a1429a405ebcf04652d7f0a4 100644 (file)
@@ -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. <a href="https://www.adminer.org/en/extension/" target="_blank">Implement</a> %s method to make it permanent.' => 'Xx.',
        'Language' => 'Xx',
index b07d2c200fb17f59162e0bf11fe22ac30dbc385e..f0ce0e3427f09aa064683e99764260dd934c36be 100644 (file)
@@ -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;
index a073a70a257f7c3c8f12d9d567e391e224b904ca..3011a08aa2ecd693a0d1bf91b0abac456b97f6a6 100644 (file)
@@ -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):