unfoldadmin / django-unfold

Modern Django admin theme for seamless interface development
https://unfoldadmin.com
MIT License
1.66k stars 166 forks source link

Django authorisation accounts/password_change working, but accounts/password_reset not. #384

Closed William-Wildridge closed 3 months ago

William-Wildridge commented 4 months ago

I note that:

accounts/password_change has the expected unfold style: image

But accounts/password_reset doesn't, looking into the html it seems that no tailwind styling is added like the reset view: image

Just the basic reset password form is included, but it renders with limited usability:

<html>
<body>
<!--StartFragment-->
<form method="post"><input type="hidden" name="csrfmiddlewaretoken" value="SECRET">
--
  | <fieldset class="module aligned">
  | <div class="form-row field-email">
  |  
  | <label for="id_email">Email address:</label>
  | <input type="email" name="email" autocomplete="email" maxlength="254" required id="id_email">
  | </div>
  | <input type="submit" value="Reset my password">
  | </fieldset>
  | </form>

<!--EndFragment-->
</body>
</html>

On a white themed background (the default non-l;ogged in experience), this has almost no usability.

andrew-gardener commented 3 months ago

To add to this, it would be nice if this by default override the registration/password_reset_form, registration/password_reset_confirm, registration/password_reset_confirm, and registration/password_change_form templates used by django.contrib.auth.views's PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, and PasswordResetCompleteView views

lukasvinclav commented 3 months ago

These are two different problems:

  1. The change password form needs to be overriden by the form provided in Unfold where all CSS classes are overridden. In README you can find docs: https://github.com/unfoldadmin/django-unfold?tab=readme-ov-file#user-admin-form

  2. The second problem is password reset form. This form is class based view which lives outside of admin thus does not have an access to the Unfold's admin site which holds for example admin colors so I can not style it properly. Here the recommendation is to style these pages in your own project so they will match your FE visual. In #541 I fixed the button on the login form.

Regarding the password reset form and proper styles, new view mixin would be required which will expose some UNFOLD settings like color combination and overriden form with proper classes. But this is out the scope right now and not in roadmap.