From e6af746c174d0f6540a655aa6406008c00c88d11 Mon Sep 17 00:00:00 2001
From: jeancf <jc@noirextreme.com>
Date: Thu, 24 Nov 2022 09:33:31 +0100
Subject: [PATCH] Corrected login issue

---
 twoot.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/twoot.py b/twoot.py
index bd83770..99c445d 100755
--- a/twoot.py
+++ b/twoot.py
@@ -333,6 +333,7 @@ def is_time_valid(timestamp):
 def login(password):
 
     instance = TOML['config']['mastodon_instance']
+    logging.info('Logging in to ' + instance + ' as ' + TOML['config']['twitter_account'])
     # Create Mastodon application if it does not exist yet
     if not os.path.isfile(instance + '.secret'):
         try:
@@ -355,11 +356,10 @@ def login(password):
         )
 
         mastodon.log_in(
-            username=TOML['config']['twitter_account'],
+            username=TOML['config']['mastodon_user'],
             password=password,
-            to_file=TOML['config']['twitter_account'] + ".secret"
+            to_file=TOML['config']['mastodon_user'] + ".secret"
         )
-        logging.info('Logging in to ' + instance)
 
     except MastodonError as me:
         logging.fatal('ERROR: Login to ' + instance + ' Failed')