Skip to content

Commit

Permalink
feat: plugin "PredefinedLogin" which logs in with username/password p…
Browse files Browse the repository at this point in the history
…redefined in server env vars
  • Loading branch information
rophy committed Mar 7, 2024
1 parent 88647b9 commit c9363d9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugins/login-predefined.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/** Login with predefined user set in env vars
* @link https://www.adminer.org/plugins/#use
* @author Rophy Tsai <[email protected]>
* @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 <input type="hidden" name="auth['.$name.']" value="predefined">';
return $heading . $value;
}

}

0 comments on commit c9363d9

Please sign in to comment.