Rollback Point - facebok E-Mail Code geht wieder
Dieser Commit ist enthalten in:
@ -643,37 +643,56 @@ class FacebookRegistration:
|
||||
def _check_needs_verification(self) -> bool:
|
||||
"""
|
||||
Prüft ob eine E-Mail-Verifikation erforderlich ist.
|
||||
|
||||
Wartet auf Navigation zur Verifikationsseite falls nötig.
|
||||
|
||||
Returns:
|
||||
bool: True wenn Verifikation erforderlich
|
||||
"""
|
||||
try:
|
||||
# Warte kurz
|
||||
self.automation.human_behavior.random_delay(2.0, 3.0)
|
||||
|
||||
# Prüfe URL
|
||||
current_url = self.automation.browser.page.url
|
||||
if "confirmemail" in current_url or "confirm" in current_url:
|
||||
logger.info("E-Mail-Verifikation erforderlich (URL-Check)")
|
||||
return True
|
||||
|
||||
# Prüfe auf Verifikations-Input
|
||||
if self.automation.browser.is_element_visible(self.selectors.VERIFICATION_CODE_INPUT, timeout=2000):
|
||||
logger.info("E-Mail-Verifikation erforderlich (Input-Field)")
|
||||
return True
|
||||
|
||||
# Prüfe auf Verifikations-Text
|
||||
# Warte auf Page-Load nach Submit
|
||||
self.automation.human_behavior.wait_for_page_load(multiplier=1.5)
|
||||
|
||||
# Warte zusätzlich auf mögliche Navigation zur Verifikationsseite
|
||||
# Versuche bis zu 10 Sekunden lang die URL zu prüfen
|
||||
max_wait_time = 10 # Sekunden
|
||||
check_interval = 0.5 # Sekunden
|
||||
attempts = int(max_wait_time / check_interval)
|
||||
|
||||
for attempt in range(attempts):
|
||||
current_url = self.automation.browser.page.url
|
||||
logger.debug(f"Prüfe URL (Versuch {attempt + 1}/{attempts}): {current_url}")
|
||||
|
||||
# Prüfe URL auf Verifikations-Pattern
|
||||
if "confirmemail" in current_url or "confirm" in current_url:
|
||||
logger.info(f"E-Mail-Verifikation erforderlich (URL-Check): {current_url}")
|
||||
return True
|
||||
|
||||
# Prüfe auf Verifikations-Input
|
||||
if self.automation.browser.is_element_visible(self.selectors.VERIFICATION_CODE_INPUT, timeout=500):
|
||||
logger.info("E-Mail-Verifikation erforderlich (Input-Field gefunden)")
|
||||
return True
|
||||
|
||||
# Prüfe auf Erfolgs-Indikatoren (dann keine Verifikation nötig)
|
||||
for indicator in self.selectors.SUCCESS_INDICATORS:
|
||||
if self.automation.browser.is_element_visible(indicator, timeout=500):
|
||||
logger.info(f"Keine Verifikation nötig (Erfolgs-Indikator gefunden: {indicator})")
|
||||
return False
|
||||
|
||||
# Kurze Pause vor nächstem Versuch
|
||||
time.sleep(check_interval)
|
||||
|
||||
# Nach max_wait_time: Finale Prüfung mit Keywords
|
||||
page_content = self.automation.browser.page.content().lower()
|
||||
verification_keywords = ["bestätigungscode", "verification code", "confirm email", "code eingeben"]
|
||||
|
||||
|
||||
for keyword in verification_keywords:
|
||||
if keyword in page_content:
|
||||
logger.info(f"E-Mail-Verifikation erforderlich (Keyword: {keyword})")
|
||||
return True
|
||||
|
||||
|
||||
logger.info("Keine E-Mail-Verifikation erforderlich")
|
||||
return False
|
||||
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Fehler bei Verifikations-Check: {e}")
|
||||
return False
|
||||
|
||||
@ -578,6 +578,8 @@ class EmailHandler:
|
||||
r"[^\d](\d{6})[^\d]" # 6-stellige Zahl umgeben von Nicht-Ziffern
|
||||
],
|
||||
"facebook": [
|
||||
r"FB-(\d{5})", # Format: FB-24518 (häufigstes Format)
|
||||
r"Bestätigungscode lautet (\d{5})", # "Dein Bestätigungscode lautet 24518"
|
||||
r"Dein Code ist (\d{5})",
|
||||
r"Your code is (\d{5})",
|
||||
r"Bestätigungscode: (\d{5})",
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren