icloud-photos-downloader / icloud_photos_downloader

A command-line tool to download photos from iCloud
MIT License
6.56k stars 532 forks source link

MFA email notification prevents MFA verification code in WebUI #911

Open S0urceror opened 1 month ago

S0urceror commented 1 month ago

Overview

When smtp_username is specified the MFA dialogue in the WebUI only asks for password but never for verification code. When you delete the smtp_username it does work.

Steps to Reproduce

  1. set smtp_username, password, host and port
  2. set mfa-provider to webui
  3. restart docker container

Expected Behavior

First ask for a password. Then ask for the verification code.

Actual Behavior

Only asks for a password and never asks for the verification.

Context

The code contains:

        if icloud.requires_2fa:
            **if raise_error_on_2sa:
                raise TwoStepAuthRequiredError("Two-factor authentication is required")**
            logger.info("Two-factor authentication is required (2fa)")
            if mfa_provider == MFAProvider.WEBUI:
                request_2fa_web(icloud, logger, status_exchange)
            else:
                request_2fa(icloud, logger)

        elif icloud.requires_2sa:
            if raise_error_on_2sa:
                raise TwoStepAuthRequiredError("Two-step authentication is required")
            logger.info("Two-step authentication is required (2sa)")
            request_2sa(icloud, logger)

I believe that you should not raise the 2SA error on 2FA request. And raising an exception prevents from running request_2fa_web.

holomekc commented 1 month ago

See #898