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

get_action in EmailMethod raise AttributeError if device has not email value #530

Closed
EngFarisAlsmawi opened this issue Aug 26, 2022 · 1 comment
Labels

Comments

@EngFarisAlsmawi
Copy link
Contributor

EngFarisAlsmawi commented Aug 26, 2022

masked_email = mask_email(device.email)

A method masked_email will be raise AttributeError when invoke get_action method, If you create device instance without email .
AttributeError at /account/two_factor/ 'NoneType' object has no attribute 'split'

This is fields is optional , so that you can used user email field as alternative if device email field is null.

@claudep claudep added the bug label Aug 26, 2022
@claudep
Copy link
Contributor

claudep commented Aug 26, 2022

Yes, we should do like https://github.com/django-otp/django-otp/blob/master/src/django_otp/plugins/otp_email/models.py#L70, (device.email or device.user.email). Would you like to provide a patch, with a regression test?

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