mirror of
https://github.com/vrana/adminer.git
synced 2025-08-08 15:47:00 +02:00
Require specifying credentials in login-sqlite plugin
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
function adminer_object() {
|
function adminer_object() {
|
||||||
include_once "../plugins/plugin.php";
|
include_once "../plugins/plugin.php";
|
||||||
include_once "../plugins/login-sqlite.php";
|
include_once "../plugins/login-sqlite.php";
|
||||||
return new AdminerPlugin(array(new AdminerLoginSqlite));
|
return new AdminerPlugin(array(new AdminerLoginSqlite("admin", password_hash("", PASSWORD_DEFAULT))));
|
||||||
}
|
}
|
||||||
|
|
||||||
include "./index.php";
|
include "./index.php";
|
||||||
|
@@ -1,36 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** Enable auto-login for SQLite
|
/** Enable login for SQLite
|
||||||
* @link https://www.adminer.org/plugins/#use
|
* @link https://www.adminer.org/plugins/#use
|
||||||
* @author Jakub Vrana, https://www.vrana.cz/
|
* @author Jakub Vrana, https://www.vrana.cz/
|
||||||
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
|
||||||
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
|
||||||
*/
|
*/
|
||||||
class AdminerLoginSqlite {
|
class AdminerLoginSqlite {
|
||||||
|
var $login;
|
||||||
|
var $password_hash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string
|
||||||
|
* @param string result of password_hash
|
||||||
|
*/
|
||||||
|
function AdminerLoginSqlite($login, $password_hash) {
|
||||||
|
$this->login = $login;
|
||||||
|
$this->password_hash = $password_hash;
|
||||||
|
}
|
||||||
|
|
||||||
function login($login, $password) {
|
function login($login, $password) {
|
||||||
return true;
|
if (DRIVER != "sqlite" && DRIVER != "sqlite2") {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
function loginForm() {
|
return $this->login == $login && password_verify($password, $this->password_hash);
|
||||||
?>
|
|
||||||
<script<?php echo nonce(); ?>>
|
|
||||||
addEventListener('load', function () {
|
|
||||||
var driver = qs('name="auth[driver]"');
|
|
||||||
if (isTag(driver, 'select')) {
|
|
||||||
driver.onchange = function () {
|
|
||||||
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].querySelector('input').disabled = disabled;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
driver.onchange();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user