jazzband / django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.
MIT License
1.71k stars 448 forks source link

Use unique block names in templates? #410

Open dkron opened 3 years ago

dkron commented 3 years ago

What do you think about using block names with prefixes - _2facontent instead of content for example?

Expected Behavior

When I add this lib to my project I override and customize base template according to my project layout without problem

Current Behavior

When I try to extend base template from my project layout it was not easy because project layout already has content block.

So the only ways I see:

  1. Duplicate project layout to base template and did all future templates changes twice.
  2. Override all templates that is also will be pain in future when two factor templates will be updated in new versions.

Or maybe I see no obvious way to deal with it?

Possible Solution

Add project context to blocks - 2fa_content 2fa_content_wrapper to be sure that it can be used together with outer templates without problems.

I understand that it will affect all current users after update.

I can provide pull request with this changes if it make sense.

moggers87 commented 3 years ago

I can see why you'd want this, and if I were to start this project from scratch I'd totally do it.

However, I don't see a way of making this change without breaking things for users who are extending our templates.

Maybe this should go on the 2.0 wishlist? :smile_cat:

dkron commented 3 years ago

Thanks for response, yes maybe it's feature for major upgrade. Good to know that it's make sense and could be implemented in future.