Answer the question
In order to leave comments, you need to log in
Python. Django. How to limit the user access to certain pages through the search bar?
Python. Django. The password recovery process via email has several html pages, the first is password-reset, which can be accessed through the login page, on this page you need to enter an email, after which the user is redirected to a page where he is informed about the instructions, but this page can be accessed through search string, knowing the page address. How to privatize it or restrict access to it?
Answer the question
In order to leave comments, you need to log in
referer = request.META.get('HTTP_REFERER')
if referer != reverse('accounts:reset'):
raise PermissionDenied
def password_reset(request):
if request.user.is_authenticated:
return render(request, 'page/password_reset.html', locals())
else:
return redirect('/page/login/', locals())
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question