SQLite: Require credentials to use (thanks to Vincent Waart)
This commit is contained in:
parent
a5b65fba5b
commit
7a33661b72
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue