From c9363d9dcbfb1d48b070d4af109c468cdf86e366 Mon Sep 17 00:00:00 2001 From: Rophy Tsai Date: Fri, 8 Mar 2024 07:49:09 +0800 Subject: [PATCH] feat: plugin "PredefinedLogin" which logs in with username/password predefined in server env vars --- plugins/login-predefined.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/login-predefined.php diff --git a/plugins/login-predefined.php b/plugins/login-predefined.php new file mode 100644 index 000000000..ffb538a9f --- /dev/null +++ b/plugins/login-predefined.php @@ -0,0 +1,19 @@ + +* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 +*/ +class PredefinedLogin { + + function credentials() { + return array(SERVER, $_ENV["ADMINER_PREDEFINED_PASSWORD"], $_ENV["ADMINER_PREDEFINED_PASSWORD"]); + } + + function loginFormField($name, $heading, $value) { + if ($name == 'username' || $name == 'password') $value = 'Predefined '; + return $heading . $value; + } + +}