MetaTrader 5 account login with incorrect credentials

 

I connect to the MT5 terminal using the MetaTrader 5 library, but I encountered an issue: when a user enters incorrect credentials in MetaTrader 5, the terminal becomes unresponsive, repeatedly attempting to connect to a nonexistent account. This prevents users with valid credentials from logging in.

I've tried using a timeout for the .login() method, but it hasn't helped. If anyone has encountered the same issue, please help me.