Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valid_mail regex is too strict #366

Open
stefan2904 opened this issue Mar 18, 2024 · 3 comments
Open

valid_mail regex is too strict #366

stefan2904 opened this issue Mar 18, 2024 · 3 comments
Labels

Comments

@stefan2904
Copy link

stefan2904 commented Mar 18, 2024

(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 amazon@accounts.failing.systems 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('foo@test.de')
True
>>> is_valid_email('foo@subdomain.test.de')
False
@mkb79
Copy link
Owner

mkb79 commented Mar 18, 2024

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.

@stefan2904
Copy link
Author

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

Copy link

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

@github-actions github-actions bot added the stale label May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants