The view definitely does not populate on my end but password_reset_confirm.html in the demo template folder seems to do that.
password_reset_confirm_form.html
urls.py
JavaScript
x
7
1
path("dj-rest-auth/password/reset/confirm/<str:uid>/<str:token>/",
2
# TemplateView.as_view(template_name="password_reset_confirm.html"),
3
PasswordResetConfirmView.as_view(),
4
name='resend-email-verification'
5
),
6
7
Edit: maybe this webpage here is not the same page in django-rest-auth demo folder.
Advertisement
Answer
Answer credits to GitHub user, riteshbisht.
What I am seeing is UI of browsable API of django rest framework that does not have this functionality for reading url and populating form field unless I tell it to.
For it to do this, I created templates/rest_framework/api.html
file and inserted following code inside it:
api.html
JavaScript
1
71
71
1
{% extends "rest_framework/base.html" %}
2
3
{% block style %}
4
{{ block.super }}
5
<style>
6
#btn-link {
7
border: none;
8
outline: none;
9
background: none;
10
display: block;
11
padding: 3px 20px;
12
clear: both;
13
font-weight: 400;
14
line-height: 1.42857143;
15
color: #A30000;
16
white-space: nowrap;
17
width: 100%;
18
text-align: left;
19
}
20
#btn-link:hover {
21
background: #EEEEEE;
22
color: #C20000;
23
}
24
</style>
25
{% endblock %}
26
27
{% block userlinks %}
28
{% if user.is_authenticated or response.data.access_token %}
29
<li class="dropdown">
30
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
31
{% firstof user.username 'Registered' %}
32
<b class="caret"></b>
33
</a>
34
<ul class="dropdown-menu dropdown-menu-right">
35
{% url 'rest_user_details' as user_url %}
36
<li><a href="{{ user_url }}">User</a></li>
37
<li>
38
{% url 'rest_logout' as logout_url %}
39
<form action="{{ logout_url }}" method="post">
40
{% csrf_token %}
41
<button type="submit" id="btn-link">Logout</button>
42
</form>
43
</li>
44
</ul>
45
</li>
46
{% else %}
47
{% url 'rest_login' as login_url %}
48
<li><a href="{{ login_url }}">Login</a></li>
49
{% url 'rest_register' as register_url %}
50
<li><a href="{{ register_url }}">Register</a></li>
51
{% endif %}
52
{% endblock %}
53
54
55
{% block script %}
56
{{block.super}}
57
<script type="text/javascript">
58
var url_elements = window.location.pathname.split('/');
59
if (url_elements.length >= 3){
60
var uid = url_elements[url_elements.length - 3];
61
if (uid !== undefined){
62
$('input[name=uid]').val(uid);
63
}
64
var token = url_elements[url_elements.length - 2];
65
if (token !== undefined){
66
$('input[name=token]').val(token);
67
}
68
}
69
</script>
70
{% endblock %}
71