I'm setting up a website with a fairly basic users system where you can do the usual stuff like login, change your password etc. I'm using an example Django project and changing it a bit here and there.
When the user is logged in I am able to access the user's email address and put it into the page by adding this to the template {{ request.user.email }}.
But in a link emailed to user to reset their password where the user is not logged in the same thing doesn't work. I'm guessing it must be possible to access it somehow though.
This is the class view that I'm using:
class RestorePasswordConfirmView(PasswordResetConfirmView):
template_name = 'accounts/restore_password_confirm.html'
def form_valid(self, form):
form.save()
messages.success(self.request, _('Your password has been set. You may go ahead and log in now.'))
return redirect('/')
def get_context_data(self, **kwargs):
context = super(RestorePasswordConfirmView, self).get_context_data(**kwargs)
context = {**context, **host_(self.request)}
return context
Is there any way to access the user.email variable?