Skip to content

Instantly share code, notes, and snippets.

View lordsarcastic's full-sized avatar
🌳
Abide with me, fast falls the eventide

lordsarcastic lordsarcastic

🌳
Abide with me, fast falls the eventide
View GitHub Profile
@lordsarcastic
lordsarcastic / Implement OTP for Django application for multiple uses
Last active April 24, 2024 14:06
This is a generic implementation of OTP for Django applications. It can be extended to any framework or platform that uses OTP.
This is a robust implementation that is extensible for anything that requires the use of OTP. Want to use OTP to verify
a user? Check! Want to use OTP to validate an order? CHeck! Want to use OTP to reset a password? CHEck! Want to use
OTP to verify a device? CHECk! Want to use OTP to fight people? CHECK!
I used: Django (framework), Django Rest Framework (a plugin for REST API), PostgreSQL (database)
and email (for sending the otp). You can substitute any of these for whatever you want, like using Redis instead of Postgres.
While this solution is built to be used for Django, I have added comments to explain the process for developers using
other frameworks.
Legend:
@lordsarcastic
lordsarcastic / Customize Djoser return data
Last active March 29, 2023 04:21
Return more information for user on signup in Django Djoser
.
@lordsarcastic
lordsarcastic / Add user data to access and refresh token on Django simple jwt
Last active March 29, 2023 04:22
Add more details to the access and refresh token gotten from login on SimpleJWT with Django
.