Files
adminer/plugins/login-password-less.php

38 lines
1.2 KiB
PHP
Raw Normal View History

2016-11-28 10:09:51 -08:00
<?php
2025-04-07 16:32:57 +02:00
/** Enable login without password
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
*/
2025-04-07 16:32:57 +02:00
class AdminerLoginPasswordLess extends Adminer\Plugin {
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()
*/
function __construct($password_hash) {
$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
function login($login, $password) {
2018-05-04 16:52:41 +02:00
if ($password != "") {
return true;
}
2016-11-28 10:09:51 -08:00
}
protected $translations = array(
'cs' => array('' => 'Povolí přihlášení bez hesla'),
'de' => array('' => 'Ermöglicht die Anmeldung ohne Passwort'),
'pl' => array('' => 'Włącz logowanie bez hasła'),
'ro' => array('' => 'Activați autentificarea fără parolă'),
'ja' => array('' => 'パスワードなしのログインを許可'),
);
2016-11-28 10:09:51 -08:00
}