I want to be able to send a password reset email using django.contrib.auth.views.password_reset but without using the browser - password_reset needs a populated form, is there a way I can create this programmatically and get the email sent?
from django.contrib.auth.forms import PasswordResetForm
def reset_password(email, from_email, template='registration/password_reset_email.html', domain_override="localhost:8000"):
"""
Reset the password for all (active) users with the given E-Mail address
"""
form = PasswordResetForm({'email': email})
if form.is_valid():
return form.save(from_email=from_email, email_template_name=template)