Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Refactor code
Aleksander Spyrad9b3db0be67e
diff --git a/saleor/dashboard/emails.py b/saleor/dashboard/emails.pyindex ae0ed8a68a..aac068357c 100644--- a/saleor/dashboard/emails.py+++ b/saleor/dashboard/emails.py@@ -31,23 +31,8 @@ def _send_set_password_email(pk, template_name):@shared_task-def send_set_password_email(staff_pk):- staff = User.objects.get(pk=staff_pk)- uid = urlsafe_base64_encode(force_bytes(staff.pk)).decode()- token = default_token_generator.make_token(staff)- password_set_url = build_absolute_uri(- reverse(- 'account:reset-password-confirm',- kwargs={- 'token': token,- 'uidb64': uid}))- ctx = get_email_base_context()- ctx['password_set_url'] = password_set_url- send_templated_mail(- template_name='dashboard/staff/set_password',- from_email=settings.DEFAULT_FROM_EMAIL,- recipient_list=[staff.email],- context=ctx)+def send_set_password_staff_email(staff_pk):+ _send_set_password_email(staff_pk, 'dashboard/staff/set_password')@shared_taskdiff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.pyindex 4b572ba224..10f78ebf7c 100644--- a/saleor/dashboard/staff/views.py+++ b/saleor/dashboard/staff/views.py@@ -8,7 +8,7 @@ from django.utils.translation import pgettext_lazyfrom ...account.models import Userfrom ...core.utils import get_paginator_itemsfrom ..emails import (- send_promote_customer_to_staff_email, send_set_password_email)+ send_promote_customer_to_staff_email, send_set_password_staff_email)from ..views import staff_member_requiredfrom .filters import StaffFilterfrom .forms import StaffForm@@ -63,7 +63,7 @@ def staff_create(request):'Dashboard message', 'Added staff member %s') % (staff,)messages.success(request, msg)if created:- send_set_password_email.delay(staff.pk)+ send_set_password_staff_email.delay(staff.pk)else:send_promote_customer_to_staff_email.delay(staff.pk)return redirect('dashboard:staff-list')