snapshot: preserve current onboarding offboarding portal state

This commit is contained in:
Md Bayazid Bostame
2026-03-19 12:37:13 +01:00
parent 581ddffd54
commit 3bf43921ff
6 changed files with 215 additions and 2 deletions

View File

@@ -62,5 +62,59 @@
</form>
</div>
</div>
<script>
(function () {
function byName(name) {
return document.querySelector('[name="' + name + '"]');
}
function slugifyForEmail(value) {
const map = { 'ä': 'ae', 'ö': 'oe', 'ü': 'ue', 'ß': 'ss' };
const lower = (value || '').toLowerCase();
const mapped = lower.replace(/[äöüß]/g, function (m) { return map[m] || m; });
return mapped
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/[^a-z0-9]+/g, '.')
.replace(/^\.+|\.+$/g, '')
.replace(/\.{2,}/g, '.');
}
function extractLastName(fullName) {
const parts = (fullName || '').trim().split(/\s+/).filter(Boolean);
return parts.length ? parts[parts.length - 1] : '';
}
const fullName = byName('full_name');
const workEmail = byName('work_email');
if (!fullName || !workEmail) return;
let lastSuggested = '';
let userEditedEmail = false;
function suggestEmail() {
const lastName = extractLastName(fullName.value);
const slug = slugifyForEmail(lastName);
if (!slug) return;
const suggestion = slug + '@tub.co';
const current = (workEmail.value || '').trim();
if (!userEditedEmail || current === '' || current === lastSuggested) {
workEmail.value = suggestion;
lastSuggested = suggestion;
}
}
workEmail.addEventListener('input', function () {
const current = (workEmail.value || '').trim();
userEditedEmail = current !== '' && current !== lastSuggested;
});
fullName.addEventListener('input', suggestEmail);
fullName.addEventListener('change', suggestEmail);
fullName.addEventListener('blur', suggestEmail);
suggestEmail();
}());
</script>
</body>
</html>

View File

@@ -108,7 +108,8 @@
<li>User opens <code>/offboarding/new/</code> and can search existing profile first.</li>
<li>Form saves request with requester name/email from logged-in user.</li>
<li>Task <code>process_offboarding_request</code> runs in worker.</li>
<li>PDF is generated (hardware section can be derived from latest onboarding request).</li>
<li>PDF is generated. If a previous onboarding request exists, the hardware section can be derived from that onboarding data.</li>
<li>If no saved onboarding request exists for that person, the offboarding PDF automatically falls back to a manual onboarding reference sheet with grouped onboarding fields and printable checkbox lists.</li>
<li>Notification emails are sent (default + rules).</li>
<li>PDF upload to Nextcloud runs if enabled.</li>
</ol>
@@ -137,6 +138,7 @@
<li>Output folder: <code>/backend/media/pdfs/</code>.</li>
<li>Signature images are embedded for compatibility with xhtml2pdf rendering.</li>
<li>Conditional sections are hidden if no data is provided.</li>
<li>Offboarding fallback behavior: if no onboarding record is available, the PDF renders a manual onboarding review layout grouped into <code>Stammdaten</code>, <code>Vertrag</code>, <code>IT-Setup</code>, and <code>Abschluss</code>, plus checkbox grids for devices, software, accesses, workspace groups, resources, and additional IT items.</li>
</ul>
<h2 id="integrations">8) Integrations</h2>
@@ -179,6 +181,14 @@
<li>Use Docker Compose for web + worker + db + redis services.</li>
<li>After template/form/task changes, restart web and worker containers.</li>
<li>Run <code>python manage.py check</code> before release.</li>
<li>On a fresh database, the web container boot sequence now runs <code>python manage.py bootstrap_initial_users</code> right after migrations.</li>
</ul>
<h3>Initial Bootstrap Users</h3>
<ul>
<li>Admin test user: <code>admin_test</code> / <code>admin12345</code></li>
<li>Normal test user: <code>user_test</code> / <code>user12345</code></li>
<li>The bootstrap step only creates these accounts when the user table is empty, so later restarts do not overwrite real users.</li>
</ul>
<h2 id="hardening">11) Security & Reliability Hardening (Current)</h2>
@@ -222,6 +232,12 @@
<li>Check SMTP settings and worker logs.</li>
</ul>
<h3>Login fails after fresh stack start</h3>
<ul>
<li>The system should bootstrap the initial users automatically after migrations on an empty database.</li>
<li>If login still fails, inspect web logs for <code>bootstrap_initial_users</code> and confirm the database volume was initialized correctly.</li>
</ul>
<h3>Nextcloud upload missing</h3>
<ul>
<li>Verify Nextcloud is enabled.</li>
@@ -239,7 +255,7 @@
</ul>
<div class="note">
Last updated for current system behavior as of March 10, 2026.
Last updated for current system behavior as of March 19, 2026.
</div>
</div>
</body>