Skip to content

Instantly share code, notes, and snippets.

View garzuze's full-sized avatar
:octocat:

Lucas Garzuze Cordeiro garzuze

:octocat:
View GitHub Profile
@garzuze
garzuze / serializers.py
Created February 26, 2025 10:07
How to create an email verification system without having to add any extra field in your user model - Django
# Create a User registration serializer
# When the user sends the request with his data — in this case, email and password —,
# we create a new user with is_verified=False (builtin field in default user model)
# Then we send an email containing a verification link
# You can customize it so you link points to a route in your fronted, if you use Django only for the backend
# After that you can create a view that uses this serializer
from django.urls import reverse
from rest_framework import serializers
from django.core.mail import send_mail
from django.conf import settings