Skip to content

FEATURE REQUEST: Passing context to email device #786

@apapsch

Description

@apapsch

Is your feature request related to a problem? Please describe.

EmailDevice adds its own parameter extra_context to generate_challenge, which is nice, but isn't used anywhere (as far as I can tell). Passing context to my custom email template isn't possible.

Describe the solution you'd like

I did a first stab here in this branch: master...apapsch:django-two-factor-auth:context-data-for-email

Adding get_device_context_data method allows me to add context in my custom views.

This breaks some tests, because only EmailDevice has the extra_context parameter.

I have some questions about this:

  • Is this approach adding get_device_context_data acceptable?
  • Would special casing EmailDevice (or introspecting the method signature to look for extra_context) be acceptable? Or add extra_context to the base method? The latter is more complicated, as the base method is defined in django-otp dependency.

Describe alternatives you've considered

No alternative has been considered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions