diff --git a/Web/app.py b/Web/app.py index c262169..0122a0e 100755 --- a/Web/app.py +++ b/Web/app.py @@ -8533,16 +8533,14 @@ def generate_compliant_password(length=16): lowers = string.ascii_lowercase uppers = string.ascii_uppercase digits = string.digits - symbols = "!@#$%^&*()_+~|}{[]:;?><,.-=" # Ensure at least one character from each required category pwd = [ secrets.choice(lowers), secrets.choice(uppers), - secrets.choice(digits), - secrets.choice(symbols) + secrets.choice(digits) ] - all_chars = lowers + uppers + digits + symbols + all_chars = lowers + uppers + digits pwd += [secrets.choice(all_chars) for _ in range(length - 4)] # Shuffle so guaranteed types aren't always at the start @@ -8666,19 +8664,29 @@ def register_csv(): # Benutzernamen & Passwort generieren username = us.build_unique_username_from_name(name, last_name) - password = generate_compliant_password(16) + password = generate_compliant_password(5) - # In DB speichern - success = us.add_user( - username=username, - password=password, - name=name, - last_name=last_name, - is_student=False, - student_card_id=None, - max_borrow_days=None, - permission_preset=permission_preset, - ) + action_permissions = None + page_permissions = None + + try: + us.add_user( + username, + password, + name, + last_name, + is_student=False, + student_card_id=None, + max_borrow_days=None, + permission_preset=permission_preset, + action_permissions=action_permissions, + page_permissions=page_permissions, + ) + success = True + except Exception as e: + app.logger.error(f"Fehler beim Erstellen des Benutzers {username}: {e}") + success = False + continue if success: created_users.append({ diff --git a/Web/modules/database/user.py b/Web/modules/database/user.py index a38c379..8b9db96 100755 --- a/Web/modules/database/user.py +++ b/Web/modules/database/user.py @@ -431,15 +431,14 @@ def check_password_strength(password): if password is None: return False - if len(password) < 12: + if len(password) < 5: return False has_lower = any(char.islower() for char in password) has_upper = any(char.isupper() for char in password) has_digit = any(char.isdigit() for char in password) - has_symbol = any(not char.isalnum() for char in password) - if not (has_lower and has_upper and has_digit and has_symbol): + if not (has_lower and has_upper and has_digit): return False return True diff --git a/Web/templates/register.html b/Web/templates/register.html index af07d7e..c43912b 100755 --- a/Web/templates/register.html +++ b/Web/templates/register.html @@ -88,11 +88,10 @@
Passwort-Anforderungen: