Audit fixes: stylesheet for notes, accessible config inputs, simplify save
This commit is contained in:
parent
a59ab505eb
commit
a84a3c4272
3 changed files with 11 additions and 9 deletions
|
|
@ -412,3 +412,10 @@ details.reference summary h2 { display: inline; }
|
||||||
details.reference[open] summary { margin-bottom: 1rem; }
|
details.reference[open] summary { margin-bottom: 1rem; }
|
||||||
|
|
||||||
.key-filter { margin-bottom: 0.8rem; }
|
.key-filter { margin-bottom: 0.8rem; }
|
||||||
|
|
||||||
|
.notes {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 1.1rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@ echo '</form>';
|
||||||
echo '</section>';
|
echo '</section>';
|
||||||
|
|
||||||
echo '<section class="card"><div class="card-head"><h2>Quick notes</h2></div>';
|
echo '<section class="card"><div class="card-head"><h2>Quick notes</h2></div>';
|
||||||
echo '<ul class="muted" style="margin:0;padding-left:1.1rem;display:grid;gap:.4rem">';
|
echo '<ul class="muted notes">';
|
||||||
echo '<li>Saving the config writes a backup first.</li>';
|
echo '<li>Saving the config writes a backup first.</li>';
|
||||||
echo '<li>Changes take effect after you restart the service.</li>';
|
echo '<li>Changes take effect after you restart the service.</li>';
|
||||||
echo '<li>Secret values are never shown. Leave a secret blank to keep it.</li>';
|
echo '<li>Secret values are never shown. Leave a secret blank to keep it.</li>';
|
||||||
|
|
@ -181,9 +181,9 @@ if (!$envReadable) {
|
||||||
echo '</td><td>';
|
echo '</td><td>';
|
||||||
if (preg_match(SECRET_PATTERN, $key)) {
|
if (preg_match(SECRET_PATTERN, $key)) {
|
||||||
$hint = $value === '' ? '(not set)' : '(set, leave blank to keep)';
|
$hint = $value === '' ? '(not set)' : '(set, leave blank to keep)';
|
||||||
echo '<input type="password" name="value[' . $name . ']" placeholder="' . h($hint) . '" autocomplete="off">';
|
echo '<input type="password" name="value[' . $name . ']" aria-label="Value for ' . $name . '" placeholder="' . h($hint) . '" autocomplete="off">';
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="text" name="value[' . $name . ']" value="' . h($value) . '">';
|
echo '<input type="text" name="value[' . $name . ']" aria-label="Value for ' . $name . '" value="' . h($value) . '">';
|
||||||
}
|
}
|
||||||
echo '</td><td class="delete"><input type="checkbox" name="delete[]" value="' . $name . '"></td></tr>';
|
echo '</td><td class="delete"><input type="checkbox" name="delete[]" value="' . $name . '"></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,7 @@ function valid_value(string $value): bool
|
||||||
|
|
||||||
function handle_save_config(): void
|
function handle_save_config(): void
|
||||||
{
|
{
|
||||||
$content = current_env();
|
$original = env_parse(current_env());
|
||||||
if ($content === '' && !is_file(config()['env_file'])) {
|
|
||||||
flash('error', 'Env file ' . config()['env_file'] . ' is missing.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$original = env_parse($content);
|
|
||||||
$deletes = array_values(array_intersect(array_map('strval', (array) ($_POST['delete'] ?? [])), array_keys($original)));
|
$deletes = array_values(array_intersect(array_map('strval', (array) ($_POST['delete'] ?? [])), array_keys($original)));
|
||||||
$posted = (array) ($_POST['value'] ?? []);
|
$posted = (array) ($_POST['value'] ?? []);
|
||||||
$changes = [];
|
$changes = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue