getting email via oauth now.

This commit is contained in:
Benni Bärmann 2021-05-17 12:41:46 +02:00
parent f56c61fee9
commit aaba27551c
8 changed files with 47 additions and 9 deletions

View File

@ -151,7 +151,6 @@ AUTHENTICATION_BACKENDS = (
SITE_ID = 1 SITE_ID = 1
ACCOUNT_EMAIL_VERIFICATION = 'none' ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_EMAIL_REQUIRED = True
LOGIN_REDIRECT_URL = 'home' LOGIN_REDIRECT_URL = 'home'
ACCOUNT_LOGOUT_ON_GET = True ACCOUNT_LOGOUT_ON_GET = True

View File

@ -29,7 +29,7 @@ class PersonalForm(EvaForm):
class Meta: class Meta:
model = Employee model = Employee
fields = ['usermail', 'firstname', 'lastname', 'intern', 'department', 'team', ] fields = ['firstname', 'lastname', 'intern', 'department', 'team', ]
class WorkingForm(EvaForm): class WorkingForm(EvaForm):

View File

@ -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 = [
]

View File

@ -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',
),
]

View File

@ -41,7 +41,7 @@ TRANSPONDER_CHOICES = {'NORM': 'Allgemeiner Transponder',
class Employee(models.Model): class Employee(models.Model):
# email adress of user. should not be necessary if we use openauth one day # 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 # personal data
firstname = models.CharField(max_length=50, verbose_name="Vorname") firstname = models.CharField(max_length=50, verbose_name="Vorname")

View File

@ -19,7 +19,7 @@
E (V A) - Eintritt, (Veränderung, Austritt)<p> E (V A) - Eintritt, (Veränderung, Austritt)<p>
</h1> </h1>
Bitte via Wolke einloggen Bitte via Wolke einloggen:
{% include "socialaccount/snippets/provider_list.html" with process="login" %} {% include "socialaccount/snippets/provider_list.html" with process="login" %}
</center> </center>

View File

@ -31,7 +31,7 @@
<img src="{% static 'evapp/logo.png' %}" /> <img src="{% static 'evapp/logo.png' %}" />
<h1> <h1>
E (V A) - Eintritt, (Veränderung, Austritt)<p> E (V A) - Eintritt, (Veränderung, Austritt)<p>
</h1> </h1>Du bist eingeloggt als {{ user.email }}
<h2> <h2>
<p>Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}</p> <p>Schritt {{ wizard.steps.step1 }} von {{ wizard.steps.count }}</p>
<p>{% if wizard.steps.step1 == 1 %} <p>{% if wizard.steps.step1 == 1 %}

View File

@ -18,7 +18,7 @@ from .forms import PersonalForm, WorkingForm, ITForm, OfficeForm, DummyForm,\
from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING from .settings import MAILS, EVA_MAIL, BASIC_DATA, ONLY_ONBOARDING
def success(request): 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): def long_process(wizard):
'''this method is called via urls.py to determine if a form is part of the IN-Process''' '''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', 'EVA: Neuzugang',
mail_template.render(context), mail_template.render(context),
EVA_MAIL, EVA_MAIL,
[EVA_MAIL, self.instance.usermail], [EVA_MAIL, self.request.user.email],
fail_silently=False) fail_silently=False)
else: else:
send_mail( send_mail(
'EVA: Neuzugang', 'EVA: Neuzugang',
mail_template.render(context), mail_template.render(context),
EVA_MAIL, EVA_MAIL,
[MAILS[department]['MAIL'], self.instance.usermail], [MAILS[department]['MAIL'], self.request.user.email],
fail_silently=False) fail_silently=False)
except BadHeaderError: except BadHeaderError:
self.instance.delete() self.instance.delete()