"feat: Implement guest job application flow"
This commit is contained in:
@@ -819,21 +819,28 @@ class GuestRequest(Base):
|
||||
|
||||
def verify_otp(self, otp_plain: str) -> bool:
|
||||
"""
|
||||
Überprüft, ob der angegebene OTP-Code gültig ist.
|
||||
Verifiziert einen OTP-Code gegen den gespeicherten Hash.
|
||||
|
||||
Args:
|
||||
otp_plain: Der zu überprüfende OTP-Code im Klartext
|
||||
otp_plain: Der zu prüfende OTP-Code im Klartext
|
||||
|
||||
Returns:
|
||||
bool: True, wenn der Code gültig ist, sonst False
|
||||
bool: True wenn der Code korrekt ist, False andernfalls
|
||||
"""
|
||||
if not self.otp_code:
|
||||
if not self.otp_code or not otp_plain:
|
||||
return False
|
||||
|
||||
otp_bytes = otp_plain.encode('utf-8')
|
||||
hash_bytes = self.otp_code.encode('utf-8')
|
||||
|
||||
return bcrypt.checkpw(otp_bytes, hash_bytes)
|
||||
try:
|
||||
# Code normalisieren (Großbuchstaben)
|
||||
otp_plain = otp_plain.upper().strip()
|
||||
|
||||
# Hash verifizieren
|
||||
otp_bytes = otp_plain.encode('utf-8')
|
||||
stored_hash = self.otp_code.encode('utf-8')
|
||||
|
||||
return bcrypt.checkpw(otp_bytes, stored_hash)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
# ===== DATENBANK-INITIALISIERUNG MIT OPTIMIERUNGEN =====
|
||||
|
Reference in New Issue
Block a user