NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

# forms.py
from django import forms

class PasswordResetForm(forms.Form):
email = forms.EmailField(label="Email")



# views.py
from django.contrib.auth.tokens import default_token_generator
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMessage
from django.template.loader import render_to_string
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.shortcuts import render, redirect
from .forms import PasswordResetForm

User = get_user_model()

def password_reset_request(request):
if request.method == "POST":
form = PasswordResetForm(request.POST)
if form.is_valid():
email = form.cleaned_data["email"]
user = User.objects.filter(email=email).first()
if user:
# Generate a reset token and send it via email
token = default_token_generator.make_token(user)
uid = urlsafe_base64_encode(force_bytes(user.pk))
current_site = get_current_site(request)
mail_subject = "Password Reset"
message = render_to_string(
"password_reset_email.html",
{
"user": user,
"domain": current_site.domain,
"uid": uid,
"token": token,
},
)
email = EmailMessage(mail_subject, message, to=[email])
email.send()
return redirect("password_reset_done")
else:
form = PasswordResetForm()
return render(request, "password_reset.html", {"form": form})





# urls.py
from django.urls import path
from . import views

urlpatterns = [
# Other URL patterns
path("password_reset/", views.password_reset_request, name="password_reset"),
path("password_reset/done/", views.password_reset_done, name="password_reset_done"),
# Add more password reset related URLs as needed
]

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.