-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: plugin "PredefinedLogin" which logs in with username/password p…
…redefined in server env vars
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |