Merge pull request 'Dev' (#8) from dev into main

Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
2026-09-08 15:48:45 +00:00
+32 -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'];
} }
@@ -310,6 +310,20 @@ $redirectUri = rtrim(APP_URL, '/') . '/auth/callback_microsoft.php';
</div> </div>
<p>4. Maak een geheim aan onder <em>Certificaten en geheimen</em>.</p> <p>4. Maak een geheim aan onder <em>Certificaten en geheimen</em>.</p>
<p>5. Voeg API-machtigingen toe: <code>Calendars.Read</code>, <code>User.Read</code>, <code>offline_access</code>.</p> <p>5. Voeg API-machtigingen toe: <code>Calendars.Read</code>, <code>User.Read</code>, <code>offline_access</code>.</p>
<p>6. <strong class="text-amber-300">Cruciaal voor organisaties:</strong> Klik direct boven de tabel met machtigingen op de knop <strong class="text-white">"Beheerdersgoedkeuring verlenen voor [Organisatie]"</strong> (<em>Grant admin consent</em>) en bevestig met 'Ja'. Hiermee voorkomt u de melding <em>"Beheerdersgoedkeuring vereist"</em>.</p>
<?php
$curClientId = !empty($outlookSettings['client_id']) ? $outlookSettings['client_id'] : fociz_env('MICROSOFT_CLIENT_ID', '');
$curTenantId = !empty($outlookSettings['tenant_id']) ? $outlookSettings['tenant_id'] : 'organizations';
if (!empty($curClientId)):
$adminConsentUrl = "https://login.microsoftonline.com/" . urlencode($curTenantId) . "/adminconsent?client_id=" . urlencode($curClientId) . "&redirect_uri=" . urlencode($redirectUri);
?>
<div class="mt-2 pt-2 border-t border-slate-800/80">
<a href="<?= htmlspecialchars($adminConsentUrl) ?>" target="_blank" class="inline-flex items-center space-x-1.5 text-[11px] text-amber-400 hover:text-amber-300 underline font-semibold">
<i data-lucide="shield-alert" class="w-3.5 h-3.5"></i>
<span>Direct Beheerdersgoedkeuring verlenen via Microsoft &rarr;</span>
</a>
</div>
<?php endif; ?>
</div> </div>
</details> </details>
</div> </div>
@@ -341,11 +355,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 +562,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 +706,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') {