Skip to content

TelegramClient.edit_2fa returns invalid value when disabling 2FA with invalid password #4526

@nimaxin

Description

@nimaxin

Code that causes the issue

async with TelegramClient(...) as client:
        result = await client.edit_2fa("invalid password", None)
        print(result) # True

Expected behavior

I encountered an issue when attempting to disable 2FA on an account that does not have 2FA enabled. The method TelegramClient.edit_2fa returns an invalid value when I pass an invalid password instead of None as the current_password parameter.

Steps to Reproduce:

  • Use an account that does not have 2FA enabled.
  • Attempt to disable 2FA using TelegramClient.edit_2fa, providing an invalid password instead of None as the current_password parameter.

Actual behavior

It should return False

Traceback

No response

Telethon version

1.38.1

Python version

3.11.9

Operating system (including distribution name and version)

Ubuntu 24.04

Other details

No response

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't an open duplicate.
  • I ran pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip and triggered the bug in the latest version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions