Fehler bei Anlage korrigiert

This commit is contained in:
Bkolb 2026-04-03 18:31:33 +02:00
parent 123ba4ca41
commit 9726738a8a
3 changed files with 58 additions and 2 deletions

View File

@ -18,7 +18,7 @@ from flask import (
from werkzeug.security import check_password_hash, generate_password_hash from werkzeug.security import check_password_hash, generate_password_hash
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
from config import Config, COUNTRY_VAT_LABELS, FILES_DIR from config import Config, COUNTRY_VAT_LABELS
from db import get_connection, fetchone_dict, fetchall_dict from db import get_connection, fetchone_dict, fetchall_dict
from auth import login_required from auth import login_required
from permissions import is_video_allowed_for_level, is_course_allowed_for_level, get_allowed_checklist_levels_for_mandant_level from permissions import is_video_allowed_for_level, is_course_allowed_for_level, get_allowed_checklist_levels_for_mandant_level

View File

@ -11,9 +11,11 @@ class Config:
DB_PORT = os.getenv("DB_PORT", "5432") DB_PORT = os.getenv("DB_PORT", "5432")
LOG_DIR = os.getenv("LOG_DIR", "./logs") LOG_DIR = os.getenv("LOG_DIR", "./logs")
FILES_DIR = os.getenv("FILES_DIR", "/app/files")
COUNTRY_VAT_LABELS = { COUNTRY_VAT_LABELS = {
"DE": "inkl. 19% USt", "DE": "inkl. 19% USt",
"AT": "inkl. 20% USt", "AT": "inkl. 20% USt",
"CH": "exkl. MwSt", "CH": "exkl. MwSt",
} }

View File

@ -59,6 +59,29 @@
min="0"> min="0">
</div> </div>
<div class="form-row">
<label for="admin_name">Admin User Name</label>
<input type="text" id="admin_name" name="admin_name"
value="{{ form_values.admin_name if form_values else '' }}" required>
</div>
<div class="form-row">
<label for="admin_email">Admin User E-Mail</label>
<input type="email" id="admin_email" name="admin_email"
value="{{ form_values.admin_email if form_values else '' }}" required>
</div>
<div class="form-row">
<label for="admin_password">Admin Passwort</label>
<input type="password" id="admin_password" name="admin_password" required>
</div>
<div class="form-row">
<label for="admin_password2">Admin Passwort bestätigen</label>
<input type="password" id="admin_password2" name="admin_password2" required>
</div>
<div class="form-row form-row-full"> <div class="form-row form-row-full">
<div id="mandant-create-error" class="error-box" style="display: none;"></div> <div id="mandant-create-error" class="error-box" style="display: none;"></div>
<button type="submit" class="btn-primary">Mandant anlegen</button> <button type="submit" class="btn-primary">Mandant anlegen</button>
@ -173,6 +196,37 @@
errorBox.innerHTML = ""; errorBox.innerHTML = "";
errorBox.style.display = "none"; errorBox.style.display = "none";
} }
const adminName = document.getElementById("admin_name").value.trim();
const adminEmail = document.getElementById("admin_email").value.trim();
const adminPassword = document.getElementById("admin_password").value;
const adminPassword2 = document.getElementById("admin_password2").value;
if (!adminName) {
errors.push("Admin User Name ist ein Pflichtfeld.");
}
if (!adminEmail) {
errors.push("Admin User E-Mail ist ein Pflichtfeld.");
} else if (!emailRegex.test(adminEmail)) {
errors.push("Bitte eine gültige Admin E-Mail-Adresse eingeben.");
}
if (!adminPassword) {
errors.push("Admin Passwort ist ein Pflichtfeld.");
}
if (!adminPassword2) {
errors.push("Bitte Admin Passwort bestätigen.");
}
if (adminPassword && adminPassword2 && adminPassword !== adminPassword2) {
errors.push("Die beiden Admin-Passwörter stimmen nicht überein.");
}
if (adminPassword && adminPassword.length < 8) {
errors.push("Das Admin Passwort muss mindestens 8 Zeichen lang sein.");
}
}); });
}); });
</script> </script>