2016-11-28 18:09:51 +00:00
|
|
|
<?php
|
|
|
|
|
2018-05-04 14:52:41 +00:00
|
|
|
/** Enable login for password-less database
|
2016-11-28 18:09:51 +00:00
|
|
|
* @link https://www.adminer.org/plugins/#use
|
2017-02-27 12:43:33 +00:00
|
|
|
* @author Jakub Vrana, https://www.vrana.cz/
|
2018-01-14 10:03:54 +00:00
|
|
|
* @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)
|
2016-11-28 18:09:51 +00:00
|
|
|
*/
|
2018-05-04 14:52:41 +00:00
|
|
|
class AdminerLoginPasswordLess {
|
2018-01-16 19:05:07 +00:00
|
|
|
/** @access protected */
|
2018-05-04 14:52:41 +00:00
|
|
|
var $password_hash;
|
2018-01-16 15:37:59 +00:00
|
|
|
|
2018-05-04 14:52:41 +00:00
|
|
|
/** Set allowed password
|
2018-01-16 15:37:59 +00:00
|
|
|
* @param string result of password_hash
|
|
|
|
*/
|
2018-05-04 14:52:41 +00:00
|
|
|
function __construct($password_hash) {
|
2018-01-16 15:37:59 +00:00
|
|
|
$this->password_hash = $password_hash;
|
2016-11-28 18:09:51 +00:00
|
|
|
}
|
2018-05-04 14:52:41 +00:00
|
|
|
|
|
|
|
function credentials() {
|
|
|
|
$password = get_password();
|
|
|
|
return array(SERVER, $_GET["username"], (password_verify($password, $this->password_hash) ? "" : $password));
|
|
|
|
}
|
2018-01-16 15:37:59 +00:00
|
|
|
|
|
|
|
function login($login, $password) {
|
2018-05-04 14:52:41 +00:00
|
|
|
if ($password != "") {
|
2018-01-16 15:37:59 +00:00
|
|
|
return true;
|
|
|
|
}
|
2016-11-28 18:09:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|