mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
1fc5d2bd45
* refactor: folder structure for urls * chore: deleted the urls file * chore: proper naming for urls * chore: reset password url * dev: create refresh token endpoint and endpoint to get settings for user * dev: workspace member me serializer * dev: remove extra fields from project list and retrieve endpoints * dev: update the project list endpoint with member details and deploy boolean * dev: enable user favorite project endpoint and remove is_favorite from project list * dev: analytics refactoring * dev: revert is_favorite settings * dev: create new serializer for project list and add pagination from projects * dev: fix analytics api * dev: module and cycle * dev: update error message, fix module analytics and add null check for labels * dev: member serializer * dev: dynamic base serializer * dev: remove view issues endpoint * dev: url pattern updates * dev: add comments to delete this file * dev: last workspace id * dev: analytics export * dev: export analytics validation * dev: update python runtime * dev: update notification endpoints * dev: cycle and validation fix * dev: issue activity validation when creating updating and deleting issue and comments * dev: update issue activity logging for link and reactions * dev: update module issue activity logging * dev: update module issue activity --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
# Django imports
|
|
from django.core.mail import EmailMultiAlternatives
|
|
from django.template.loader import render_to_string
|
|
from django.utils.html import strip_tags
|
|
from django.conf import settings
|
|
|
|
# Third party imports
|
|
from celery import shared_task
|
|
from sentry_sdk import capture_exception
|
|
|
|
# Module imports
|
|
from plane.db.models import User
|
|
|
|
|
|
@shared_task
|
|
def forgot_password(first_name, email, uidb64, token, current_site):
|
|
|
|
try:
|
|
realtivelink = f"/accounts/reset-password/?uidb64={uidb64}&token={token}"
|
|
abs_url = current_site + realtivelink
|
|
|
|
from_email_string = settings.EMAIL_FROM
|
|
|
|
subject = f"Reset Your Password - Plane"
|
|
|
|
context = {
|
|
"first_name": first_name,
|
|
"forgot_password_url": abs_url,
|
|
}
|
|
|
|
html_content = render_to_string("emails/auth/forgot_password.html", context)
|
|
|
|
text_content = strip_tags(html_content)
|
|
|
|
msg = EmailMultiAlternatives(subject, text_content, from_email_string, [email])
|
|
msg.attach_alternative(html_content, "text/html")
|
|
msg.send()
|
|
return
|
|
except Exception as e:
|
|
# Print logs if in DEBUG mode
|
|
if settings.DEBUG:
|
|
print(e)
|
|
capture_exception(e)
|
|
return
|