Merge branch 'development' of bitbucket.org:enreda/back-latienda into development
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.core.mail import EmailMessage
|
||||
from django.template.loader import render_to_string
|
||||
from core import utils
|
||||
|
||||
from core.models import CustomUser
|
||||
|
||||
@@ -11,9 +12,16 @@ class Command(BaseCommand):
|
||||
managers = CustomUser.objects.filter(role='COOP_MANAGER')
|
||||
|
||||
for manager in managers:
|
||||
try:
|
||||
password = utils.generate_password(12)
|
||||
manager.set_password(password)
|
||||
manager.save()
|
||||
except:
|
||||
return Response({'error': f"Could not set new password [{str(type(e))}]: {str(e)}"}, status=500)
|
||||
link = "https://latienda.coop/login"
|
||||
company_message = render_to_string('welcome_coop.html', {
|
||||
'manager': manager,
|
||||
'password': password,
|
||||
'link': link
|
||||
})
|
||||
# send email to company
|
||||
|
||||
Reference in New Issue
Block a user