feat(ui): replace configuration editors with graphical forms
This commit is contained in:
@@ -8,6 +8,13 @@ import re
|
||||
import secrets
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
from passlib.hash import sha512_crypt
|
||||
|
||||
|
||||
# The installer requires a Linux crypt hash. The builtin backend also works
|
||||
# on Python 3.13+, where the standard-library crypt module no longer exists.
|
||||
_installer_password_hash = sha512_crypt.using(rounds=656000)
|
||||
_installer_password_hash.set_backend("builtin")
|
||||
|
||||
|
||||
def canonical(value):
|
||||
@@ -43,6 +50,12 @@ class Security:
|
||||
result = hashlib.scrypt(password.encode(), salt=salt, n=16384, r=8, p=1)
|
||||
return "scrypt$" + base64.b64encode(salt).decode() + "$" + base64.b64encode(result).decode()
|
||||
|
||||
@staticmethod
|
||||
def hash_installer_password(password):
|
||||
if not 12 <= len(password) <= 1024 or "\x00" in password:
|
||||
raise ValueError("Root-Passwörter benötigen 12 bis 1024 Zeichen ohne Nullzeichen.")
|
||||
return _installer_password_hash.hash(password)
|
||||
|
||||
@staticmethod
|
||||
def verify_password(password, stored):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user