From 47e99e6aff57b6e78921a436bc6161f236970e31 Mon Sep 17 00:00:00 2001 From: "holger.trampe" Date: Sun, 10 May 2020 12:55:20 +0200 Subject: [PATCH] =?UTF-8?q?DEV=20F=C3=9CR=200.9.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dasettings/forms.py | 7 + .../__pycache__/settings.cpython-38.pyc | Bin 3992 -> 4065 bytes digitaleagentur/settings.py | 6 +- users/models.py | 10 +- .../users/password_to_username_mail.html | 172 ++++++++++++++++++ users/views.py | 36 +++- 6 files changed, 219 insertions(+), 12 deletions(-) create mode 100644 users/templates/users/password_to_username_mail.html diff --git a/dasettings/forms.py b/dasettings/forms.py index 11bbe89..a42438c 100644 --- a/dasettings/forms.py +++ b/dasettings/forms.py @@ -115,6 +115,13 @@ class AgencyModulsForm(forms.ModelForm): } fields = ['module_news','module_organizer','module_files','module_organigramm', 'module_messages', 'module_timemanagement'] + # RAUSNHEMEN WENN DEV DONE + def __init__(self, *args, **kwargs): + super(AgencyModulsForm, self).__init__(*args, **kwargs) + self.fields['module_timemanagement'].widget.attrs['readonly'] = True + self.fields['module_timemanagement'].widget.attrs['disabled'] = True + + # NEW USER FORM class UserNewUserForm(forms.ModelForm): diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index f348433aa6407a824c543bb4f2cf4e2a1ee3a015..3b3d210001d899a625bd6b623a2bf4ce15a52fd2 100644 GIT binary patch delta 474 zcmXYu%Tg0j5QgW>9Ac8WgnJZ;5kV1<5EPPtC`2$2AcU(xFRVK7r-sSkrJQ7=3l}cj zuu09v1q-run}zP=6?_1zuy_IA08XXsuK%yDZ}C@m^|$!nxVdARVMUhz=f~@dni*p! zwUN2mAQ=dei7;7G5vf+_Fks5I5JBr{i^Hf5ZPbo->Oco|q7z-{M%3oiRr{X&j3mbG z9_q$pJi!DekwO|7OxZz-Vw!H^sjVP{89c*t%wo>w4ny{o+l+4E1@&Ma3zE#^Wz%y_ zUv!wvzl|m8MV?|pRNHOm4puf delta 388 zcmXYtOD_X)6vgL1?aQ!NS6(=|;jr zx3*2#NPGqxONnpduW@hA$<1$Zl5>B84?#I6%NBu8`0MTPu_y=FT``uNk;n!U$y|0W z1!h=afk~h-0)~da>EN>@g;Gs`N@L>`p}O73}Ohw7|~4R z#VGkOrU{TRjtNX+3e%cVXP9|1YK-cUqz24lj+0r;SAC)Ci#p@^ex#@oOVosA3P7S} zt{_&Z1*;T7np&|&VXV_po61haXG7K7RjJI%3>!XyB306%Mvy6s)QL@s{*xMPanglt zit)g1>`)J~_$wPn4!hXX8NYiW?g-KS$~(JZ-t3hjz7e0=7)$(snCazWJMtR+FJgDw&lKlS?t>^%q%dXP5v0 diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index 8d3422d..e089b04 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -14,13 +14,12 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - ############################################## DEV ##################################### BASE_URL = "https://dev01.digitale-agentur.com/" CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D" +MAILINFOKEY = "jka7sd8iukashdna78skduJAHDsu6dilaksdjba65a68iadbhjak" # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = False # MAIL DEV EMAIL_HOST = 'smtp.strato.de' @@ -43,6 +42,7 @@ DATABASES = { ############################################## DEV ##################################### + # Nach zehn Stunden läuft der Cookie ab! SESSION_COOKIE_AGE = 8*60*60 diff --git a/users/models.py b/users/models.py index 415d28e..7c6f541 100644 --- a/users/models.py +++ b/users/models.py @@ -95,7 +95,11 @@ class Agency(models.Model): module_news = models.BooleanField(default=True) module_organizer = models.BooleanField(default=True) module_files = models.BooleanField(default=True) + module_organigramm = models.BooleanField(default=True) + # Steckbrief dynamisch aus Standard + dynamicprofile = models.BooleanField(default=True) + module_messages = models.BooleanField(default=True) # KOSTENPFLICHTIGE MODULE @@ -106,11 +110,7 @@ class Agency(models.Model): module_timemanagement_price = models.FloatField(default=10.0, max_length=9, blank=True) # Zeiterfassung Ja/Nein module_timemanagement_ze = models.BooleanField(default=False) - - - # Steckbrief dynamisch aus Standard - dynamicprofile = models.BooleanField(default=True) - + vve = models.CharField(default="", max_length=200, blank=True) def __str__(self): diff --git a/users/templates/users/password_to_username_mail.html b/users/templates/users/password_to_username_mail.html new file mode 100644 index 0000000..f6f2d4c --- /dev/null +++ b/users/templates/users/password_to_username_mail.html @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + +
+

+ +
+
+

Digitale Agentur | Accountinformation

+
+
+
+

Hallo {{user.first_name}} {{user.last_name}},

+

ab sofort können Sie sich nur noch mit Ihrer E-Mailadresse als Benutzernamen in der Digitalen Agentur anmelden. Ihre hinterlegte Adresse lautet: {{user.email}}.

+

Weitere Informationen erhalten Sie von Ihrem Agenturleiter. +

Mit freundlichen Grüßen

+

Ihr Team von Digitale Agentur

+
+
+

+ +
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/users/views.py b/users/views.py index 47a62b9..46d9e38 100644 --- a/users/views.py +++ b/users/views.py @@ -793,7 +793,8 @@ def impressum(request): ''' def cronactions(request, code): - if(code == settings.CRONAPIKEY): + data = {} + if(code == settings.CRONAPIKEY): # NEWS CHECKING all_unnotifc_news = News.objects.filter(agnotify=False, go_online_on__lt=timezone.now()) @@ -802,7 +803,7 @@ def cronactions(request, code): usersofagency = User.objects.filter(profile__agency=news.agency) news.agnotify = True news.save() - + for user in usersofagency: if(user.profile.news_mail): notificationtext = "Neue Agenturnews: " + news.name @@ -823,7 +824,34 @@ def cronactions(request, code): if(user.profile.news_push): newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + news.name, notificationtype="agencynews", elementid=news.pk) newnotification.save() + data.update({"status" : "ok"}) + elif(code == settings.MAILINFOKEY): + + # GET ALL USERS + users = User.objects.all().exclude(username="root") + + for u in users: + u.username = u.email + try: + u.save() + notificationtext = "ab sofort können Sie sich nur noch mit Ihrer E-Mailadresse anmelden. Diese lautet " + u.email + "!" + msg_html = render_to_string('users/password_to_username_mail.html', {'user': u, 'notificationtext' : notificationtext}) + send_mail( + 'Agentur-Benachrichtigung', + 'Hallo ' + u.first_name + ' ' + u.last_name + '! ' + notificationtext, + 'support@digitale-agentur.com', + [u.email], + html_message=msg_html, + fail_silently=True + ) + data.update({"user_" + str(u.pk) : u.email}) + except: + data.update({"ERROR_user_" + str(u.pk) : u.email}) else: - print("API CODE FAILED") - return JsonResponse({}) \ No newline at end of file + print("API CODE FAILED") + data.update({"status" : "failed"}) + return JsonResponse(data) + + +