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