fix: oogje (toggle password visibility) voor Client Secret en Jira API token gerepareerd

This commit is contained in:
2026-09-08 16:57:58 +02:00
parent c3b7a9b977
commit d3e6c263f8
+18 -9
View File
@@ -55,8 +55,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$existing = $stmtExisting->fetch(); $existing = $stmtExisting->fetch();
$existingSettings = json_decode($existing['settings'] ?? '{}', true) ?: []; $existingSettings = json_decode($existing['settings'] ?? '{}', true) ?: [];
// Als geheim veld leeg is gelaten, behoud het bestaande geheim // Als geheim veld leeg is gelaten of bullet tekens bevat, behoud het bestaande geheim
if (empty($clientSecret) && !empty($existingSettings['client_secret'])) { if (($clientSecret === '' || $clientSecret === '••••••••••••••••') && !empty($existingSettings['client_secret']) && $existingSettings['client_secret'] !== '••••••••••••••••') {
$clientSecret = $existingSettings['client_secret']; $clientSecret = $existingSettings['client_secret'];
} }
@@ -119,7 +119,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$existing = $stmtExisting->fetch(); $existing = $stmtExisting->fetch();
$existingSettings = json_decode($existing['settings'] ?? '{}', true) ?: []; $existingSettings = json_decode($existing['settings'] ?? '{}', true) ?: [];
if (empty($jiraToken) && !empty($existingSettings['jira_api_token'])) { if (($jiraToken === '' || $jiraToken === '••••••••••••••••') && !empty($existingSettings['jira_api_token']) && $existingSettings['jira_api_token'] !== '••••••••••••••••') {
$jiraToken = $existingSettings['jira_api_token']; $jiraToken = $existingSettings['jira_api_token'];
} }
@@ -341,11 +341,11 @@ $redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php';
type="password" type="password"
id="msClientSecret" id="msClientSecret"
name="client_secret" name="client_secret"
value="<?= !empty($outlookSettings['client_secret']) ? '••••••••••••••••' : htmlspecialchars(fociz_env('MICROSOFT_CLIENT_SECRET', '')) ?>" value="<?= htmlspecialchars(!empty($outlookSettings['client_secret']) && $outlookSettings['client_secret'] !== '••••••••••••••••' ? $outlookSettings['client_secret'] : fociz_env('MICROSOFT_CLIENT_SECRET', '')) ?>"
placeholder="Plak hier de Waarde (Value) van uw Client Secret" placeholder="Plak hier de Waarde (Value) van uw Client Secret"
class="w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 pr-8 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 font-mono" class="w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 pr-8 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-blue-500 font-mono"
> >
<button type="button" onclick="togglePasswordVisibility('msClientSecret')" class="absolute right-2 top-2 text-slate-500 hover:text-slate-300"> <button type="button" onclick="togglePasswordVisibility('msClientSecret', this)" class="absolute right-2 top-2 text-slate-500 hover:text-slate-300 transition" title="Toon / verberg geheim">
<i data-lucide="eye" class="w-3.5 h-3.5"></i> <i data-lucide="eye" class="w-3.5 h-3.5"></i>
</button> </button>
</div> </div>
@@ -548,11 +548,11 @@ $redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php';
type="password" type="password"
id="jiraApiTokenInput" id="jiraApiTokenInput"
name="jira_api_token" name="jira_api_token"
value="<?= !empty($jiraSettings['jira_api_token']) ? '••••••••••••••••' : htmlspecialchars(fociz_env('JIRA_API_TOKEN', '')) ?>" value="<?= htmlspecialchars(!empty($jiraSettings['jira_api_token']) && $jiraSettings['jira_api_token'] !== '••••••••••••••••' ? $jiraSettings['jira_api_token'] : fociz_env('JIRA_API_TOKEN', '')) ?>"
placeholder="Plak hier uw Atlassian API token" placeholder="Plak hier uw Atlassian API token"
class="w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 pr-8 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-sky-500 font-mono" class="w-full bg-slate-950 border border-slate-800 rounded-lg px-2.5 py-1.5 pr-8 text-xs text-white placeholder-slate-600 focus:outline-none focus:border-sky-500 font-mono"
> >
<button type="button" onclick="togglePasswordVisibility('jiraApiTokenInput')" class="absolute right-2 top-2 text-slate-500 hover:text-slate-300"> <button type="button" onclick="togglePasswordVisibility('jiraApiTokenInput', this)" class="absolute right-2 top-2 text-slate-500 hover:text-slate-300 transition" title="Toon / verberg token">
<i data-lucide="eye" class="w-3.5 h-3.5"></i> <i data-lucide="eye" class="w-3.5 h-3.5"></i>
</button> </button>
</div> </div>
@@ -692,10 +692,19 @@ function copyToClipboard(elementId) {
}); });
} }
function togglePasswordVisibility(inputId) { function togglePasswordVisibility(inputId, btn) {
const input = document.getElementById(inputId); const input = document.getElementById(inputId);
if (!input) return; if (!input) return;
input.type = input.type === 'password' ? 'text' : 'password'; const isNowText = input.type === 'password';
input.type = isNowText ? 'text' : 'password';
if (btn) {
btn.innerHTML = isNowText
? '<i data-lucide="eye-off" class="w-3.5 h-3.5 text-blue-400"></i>'
: '<i data-lucide="eye" class="w-3.5 h-3.5 text-slate-500"></i>';
if (typeof lucide !== 'undefined') {
lucide.createIcons();
}
}
} }
async function importJiraToTasks(btn, title, jiraKey, url, priority = 'P1') { async function importJiraToTasks(btn, title, jiraKey, url, priority = 'P1') {