Make Nextcloud user and password mandatory for all sites

- NC User and NC Pass are now required fields when adding a site
- Auto-provision Nextcloud user on site creation
- Client-side validation enforces all fields in both Add and Edit forms
- Updated placeholder text to reflect required status
- Sites without NC creds now show Not set badge instead of Global

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kamaji
2026-01-26 11:01:18 -06:00
parent a719e528ed
commit 67e35c298a
2 changed files with 31 additions and 12 deletions

View File

@@ -302,8 +302,8 @@
<input type="text" id="add-pin" placeholder="PIN" inputmode="numeric">
</div>
<div class="form-row">
<input type="text" id="add-nc-user" placeholder="NC User (optional)">
<input type="text" id="add-nc-pass" placeholder="NC Pass (optional)">
<input type="text" id="add-nc-user" placeholder="NC User">
<input type="text" id="add-nc-pass" placeholder="NC Pass">
<button type="button" class="btn btn-outline btn-gen" onclick="document.getElementById('add-nc-pass').value = generatePassword()">Gen</button>
</div>
<button class="btn btn-blue" onclick="addSite()">Add Site</button>
@@ -324,7 +324,7 @@
<span class="nc-badge missing">Not found</span>
{% endif %}
{% else %}
<span class="nc-badge global">Global</span>
<span class="nc-badge missing">Not set</span>
{% endif %}
</div>
<div class="card-actions">
@@ -391,8 +391,8 @@
const nc_user = document.getElementById('add-nc-user').value.trim();
const nc_pass = document.getElementById('add-nc-pass').value.trim();
if (!site || !pin) {
showBanner('Site number and PIN are required', 'error');
if (!site || !pin || !nc_user || !nc_pass) {
showBanner('All fields are required', 'error');
return;
}
@@ -404,7 +404,8 @@
});
const data = await resp.json();
if (data.ok) {
window.location.reload();
if (data.nc_msg) showBanner(data.nc_msg, 'success');
setTimeout(() => window.location.reload(), 1500);
} else {
showBanner(data.error || 'Failed to add site', 'error');
}
@@ -485,8 +486,8 @@
const nc_user = document.getElementById('edit-nc-user').value.trim();
const nc_pass = document.getElementById('edit-nc-pass').value.trim();
if (!pin) {
showBanner('PIN is required', 'error');
if (!pin || !nc_user || !nc_pass) {
showBanner('PIN, NC User, and NC Pass are required', 'error');
return;
}