Open lukaszla opened 4 years ago
password/reset/confirm/
re_path(
r"^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$",
views.password_reset_from_key,
name="account_reset_password_from_key",
),
Thanks @kos08001 but I'd think this module should work correctly out of the box. And I'm not sure how the fix in another module solves my issue here if I don't want to add more dependencies.
Also I believe password/reset/confirm should not be in the email as this is an API endpoint that expects POST
and JSON data in the body. So will never work as a link from email.
What I ended up doing is customize the email completely giving my own url
@lukaszla The FAQ cover this - https://dj-rest-auth.readthedocs.io/en/latest/faq.html
Thanks, I missed it.
It would be nice to add this in the same level of importance as adding the registration urls. I had to dig through issues to realise it must be added separately.
I don't get it. What do i need to do to get this working? The Demo App code is not working. Why doesn't this work out of the box?
I have solved it by adding the file /templates/registration/password_reset_email.html with the content:
{% load i18n %}{% autoescape off %}
{% blocktranslate %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktranslate %}
{% translate "Please go to the following page and choose a new password:" %}
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'rest_password_reset_confirm' %}
uid: {{ uid }}
token: {{ token }}
{% endblock %}
{% translate 'Your username, in case you’ve forgotten:' %} {{ user.get_username }}
{% translate "Thanks for using our site!" %}
{% blocktranslate %}The {{ site_name }} team{% endblocktranslate %}
{% endautoescape %}
when going live i will change reset_link to the link of the website that uses the rest-api. the predefined template isn't made to work with a rest api and makes the assumption that the website where i change my password is part of the django application, wich isn't always the case in rest-apis.
I'm using vanilla installation and after sending simple POST from swagger to /api/v1/dj-rest-auth/password/reset/ I get this error
I believe the problem lies in /dj_rest_auth/urls.py line 10 First name should be
password_reset_confirm
to refer to existing template in auth/urls.py, secondly regex must include parameters this template is called with.