From aaba27551c445ba2a734044ef1700990d766078c Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 17 May 2021 12:41:46 +0200 Subject: [PATCH] getting email via oauth now. --- eva/settings_development.py | 3 +-- evapp/forms.py | 2 +- evapp/migrations/0020_merge_20210517_0937.py | 14 +++++++++++ evapp/migrations/0021_auto_20210517_1010.py | 25 ++++++++++++++++++++ evapp/models.py | 2 +- evapp/templates/account/login.html | 2 +- evapp/templates/evapp/employee_form.html | 2 +- evapp/views.py | 6 ++--- 8 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 evapp/migrations/0020_merge_20210517_0937.py create mode 100644 evapp/migrations/0021_auto_20210517_1010.py diff --git a/eva/settings_development.py b/eva/settings_development.py index 3cf62c7..490d72a 100644 --- a/eva/settings_development.py +++ b/eva/settings_development.py @@ -151,7 +151,6 @@ AUTHENTICATION_BACKENDS = ( SITE_ID = 1 ACCOUNT_EMAIL_VERIFICATION = 'none' - +ACCOUNT_EMAIL_REQUIRED = True LOGIN_REDIRECT_URL = 'home' - ACCOUNT_LOGOUT_ON_GET = True diff --git a/evapp/forms.py b/evapp/forms.py index 5e18c0b..016f374 100644 --- a/evapp/forms.py +++ b/evapp/forms.py @@ -29,7 +29,7 @@ class PersonalForm(EvaForm): class Meta: model = Employee - fields = ['usermail', 'firstname', 'lastname', 'intern', 'department', 'team', ] + fields = ['firstname', 'lastname', 'intern', 'department', 'team', ] class WorkingForm(EvaForm): diff --git a/evapp/migrations/0020_merge_20210517_0937.py b/evapp/migrations/0020_merge_20210517_0937.py new file mode 100644 index 0000000..6e84158 --- /dev/null +++ b/evapp/migrations/0020_merge_20210517_0937.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.4 on 2021-05-17 09:37 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0019_auto_20210504_1333'), + ('evapp', '0009_auto_20210303_1115'), + ] + + operations = [ + ] diff --git a/evapp/migrations/0021_auto_20210517_1010.py b/evapp/migrations/0021_auto_20210517_1010.py new file mode 100644 index 0000000..2586b7f --- /dev/null +++ b/evapp/migrations/0021_auto_20210517_1010.py @@ -0,0 +1,25 @@ +# Generated by Django 3.1.4 on 2021-05-17 10:10 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('evapp', '0020_merge_20210517_0937'), + ] + + operations = [ + migrations.RemoveField( + model_name='employee', + name='email', + ), + migrations.RemoveField( + model_name='employee', + name='laptop', + ), + migrations.RemoveField( + model_name='employee', + name='usermail', + ), + ] diff --git a/evapp/models.py b/evapp/models.py index a7913ff..dd68e17 100644 --- a/evapp/models.py +++ b/evapp/models.py @@ -41,7 +41,7 @@ TRANSPONDER_CHOICES = {'NORM': 'Allgemeiner Transponder', class Employee(models.Model): # email adress of user. should not be necessary if we use openauth one day - usermail = models.EmailField(max_length=50, verbose_name="Deine Mailadresse (Ansprechpartner_in)", default='bestechefin@wikimedia.de') + # usermail = models.EmailField(max_length=50, verbose_name="Deine Mailadresse (Ansprechpartner_in)", default='bestechefin@wikimedia.de') # personal data firstname = models.CharField(max_length=50, verbose_name="Vorname") diff --git a/evapp/templates/account/login.html b/evapp/templates/account/login.html index 3742060..7a0ea12 100644 --- a/evapp/templates/account/login.html +++ b/evapp/templates/account/login.html @@ -19,7 +19,7 @@ E (V A) - Eintritt, (Veränderung, Austritt)

-Bitte via Wolke einloggen +Bitte via Wolke einloggen: {% include "socialaccount/snippets/provider_list.html" with process="login" %} diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html index 5e4b2d0..49e0bd9 100644 --- a/evapp/templates/evapp/employee_form.html +++ b/evapp/templates/evapp/employee_form.html @@ -31,7 +31,7 @@

E (V A) - Eintritt, (Veränderung, Austritt)

-

+ Du bist eingeloggt als {{ user.email }}

Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}

{% if wizard.steps.step1 == 1 %} diff --git a/evapp/views.py b/evapp/views.py index 4f687b6..b0c35c7 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -18,7 +18,7 @@ from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\ from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING def success(request): - return HttpResponse("Vielen Dank! Du hast E.V.A. erfolgreich ausgefüllt. Die Mails an die Abteilungen wurden versendet.") + return HttpResponse(f"Vielen Dank! Du hast E.V.A. erfolgreich ausgefüllt. Die Mails an die Abteilungen wurden versendet. Kopien gehen an {request.user.email}.") def long_process(wizard): '''this method is called via urls.py to determine if a form is part of the IN-Process''' @@ -140,14 +140,14 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): 'EVA: Neuzugang', mail_template.render(context), EVA_MAIL, - [EVA_MAIL, self.instance.usermail], + [EVA_MAIL, self.request.user.email], fail_silently=False) else: send_mail( 'EVA: Neuzugang', mail_template.render(context), EVA_MAIL, - [MAILS[department]['MAIL'], self.instance.usermail], + [MAILS[department]['MAIL'], self.request.user.email], fail_silently=False) except BadHeaderError: self.instance.delete()