Rollbackpunkt, alles außer TikTok geht, die wollen wieder so eine extra locke bei Login
Dieser Commit ist enthalten in:
@ -146,16 +146,26 @@ class SessionController(QObject):
|
||||
}
|
||||
|
||||
account_id = self.db_manager.add_account(account_record)
|
||||
|
||||
# Prüfe ob DB-Operation erfolgreich war
|
||||
if account_id == -1 or account_id is None:
|
||||
error_msg = f"Fehler beim Speichern des Accounts {account_record['username']} in der Datenbank"
|
||||
logger.error(error_msg)
|
||||
|
||||
# Prüfe DB-Operation mit spezifischen Error-Codes
|
||||
if account_id is None or account_id <= 0:
|
||||
# Bestimme spezifischen Fehler
|
||||
if account_id == -1:
|
||||
error_msg = f"Account-Daten unvollständig: Username oder Passwort fehlt"
|
||||
elif account_id == -2:
|
||||
error_msg = f"Account '{account_record['username']}' existiert bereits auf dieser Plattform"
|
||||
elif account_id == -3:
|
||||
error_msg = f"Datenbankfehler: Verbindung oder Schema-Problem"
|
||||
else:
|
||||
error_msg = f"Unbekannter Fehler beim Speichern des Accounts"
|
||||
|
||||
logger.error(f"DB-Speicherung fehlgeschlagen (Code: {account_id}): {error_msg}")
|
||||
return {
|
||||
'success': False,
|
||||
'account_id': None,
|
||||
'error': error_msg,
|
||||
'message': error_msg
|
||||
'message': error_msg,
|
||||
'error_code': account_id
|
||||
}
|
||||
|
||||
logger.info(f"Account in Datenbank gespeichert: {account_record['username']} (ID: {account_id})")
|
||||
@ -252,6 +262,15 @@ class SessionController(QObject):
|
||||
# Callbacks setzen
|
||||
self.automation.status_update_callback = lambda msg: self.status_update.emit(msg)
|
||||
self.automation.log_update_callback = lambda msg: self.log_update.emit(msg)
|
||||
elif platform == 'facebook':
|
||||
from social_networks.facebook.facebook_automation import FacebookAutomation
|
||||
self.automation = FacebookAutomation(
|
||||
headless=False,
|
||||
fingerprint=fingerprint_dict,
|
||||
window_position=self.account_data.get('window_position')
|
||||
)
|
||||
self.automation.status_update_callback = lambda msg: self.status_update.emit(msg)
|
||||
self.automation.log_update_callback = lambda msg: self.log_update.emit(msg)
|
||||
else:
|
||||
self.login_failed.emit(self.account_id, f"Plattform {platform} nicht unterstützt")
|
||||
return
|
||||
@ -263,10 +282,17 @@ class SessionController(QObject):
|
||||
self.log_update.emit(f"Öffne {platform.title()}-Webseite...")
|
||||
|
||||
# Login durchführen
|
||||
login_identifier = (
|
||||
self.account_data.get('email')
|
||||
or self.account_data.get('username')
|
||||
or self.account_data.get('phone')
|
||||
)
|
||||
|
||||
result = self.automation.login_account(
|
||||
username_or_email=self.account_data.get('username'),
|
||||
password=self.account_data.get('password'),
|
||||
account_id=self.account_id
|
||||
login_identifier,
|
||||
self.account_data.get('password'),
|
||||
account_id=self.account_id,
|
||||
raw_account_data=self.account_data
|
||||
)
|
||||
|
||||
if result['success']:
|
||||
@ -334,4 +360,4 @@ class SessionController(QObject):
|
||||
f"Ein-Klick-Login für {platform} ist nicht möglich.\n\n"
|
||||
f"Grund: {reason}\n\n"
|
||||
"Bitte melden Sie sich manuell an, um eine neue Session zu erstellen."
|
||||
)
|
||||
)
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren