Audible icon indicating copy to clipboard operation
Audible copied to clipboard

`valid_mail` regex is too strict

Open stefan2904 opened this issue 11 months ago • 3 comments

(Noticed while debugging GGyll/audible-bookmark-extractor#16)

Describe the bug I cannot authenticate. I always get the CVF prompt, but nothing happens. When enabling the log, I get a message that my email address is not valid. However, it is. ;-)

Since this is just a warning, I am not sure if this solves my problem, but the regex seems to be wrong: valid_mail = r"^[a-z0-9]+[\._-]?[a-z0-9]+[@]\w+[.]\w+$" does check for TLS but does not allow subdomains on the right of the @.

To Reproduce

  • Try to authenticate using audible.Authenticator.from_login with email and password

2024-03-18 14:03:55,519 WARNING [audible.login] login.py:349: Username [email protected] is not a valid mail address

Expected behavior Successful login, or received CFV code via email, or something like that.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Debian
  • Browser: Firefox
  • Version: 124

Additional context

Quick test using the latest regex:

>>> import re
>>> 
>>> def is_valid_email(obj: str) -> bool:
...     valid_mail = r"^[a-z0-9]+[\._-]?[a-z0-9]+[@]\w+[.]\w+$"
...     if re.match(valid_mail, obj):
...         return True
...     return False
... 
>>> is_valid_email('[email protected]')
True
>>> is_valid_email('[email protected]')
False

stefan2904 avatar Mar 18 '24 13:03 stefan2904

The email validation will give only a warning and will not result in an abort. So your issue with the authentication must be something other.

Do you have 2FA enabled? If not, this can cause the problem. It seams, Amazon has changed the the html response. So my package can not determine the correct page status. You can try to login using Authenticator.from_login_external. Maybe the response from Amazon in your browser will give you more information.

mkb79 avatar Mar 18 '24 13:03 mkb79

Thanks for the reply! You are right, I don't have MFA enabled at the moment. I'll try your suggestion!

stefan2904 avatar Mar 18 '24 14:03 stefan2904

This issue has not been updated for a while and will be closed soon.

github-actions[bot] avatar May 18 '24 03:05 github-actions[bot]

This issue has automatically been closed due to no activities.

github-actions[bot] avatar May 28 '24 03:05 github-actions[bot]