diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index a8b9b792fc..6d99e12ef8 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -17,13 +17,17 @@ from django.urls import reverse_lazy from django.shortcuts import redirect from django.conf import settings -from django.contrib.auth.mixins import PermissionRequiredMixin +from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin from django.views import View from django.views.generic import ListView, DetailView, CreateView, FormView, DeleteView, UpdateView from django.views.generic.base import RedirectView, TemplateView from djmoney.contrib.exchange.models import ExchangeBackend, Rate +from allauth.account.forms import AddEmailForm +from allauth.account.models import EmailAddress +from allauth.account.views import EmailView + from common.settings import currency_code_default, currency_codes from part.models import Part, PartCategory @@ -810,6 +814,10 @@ class SettingsView(TemplateView): except: ctx["locale_stats"] = {} + # Forms and context for allauth + ctx['add_email_form'] = AddEmailForm + ctx["can_add_email"] = EmailAddress.objects.can_add_email(self.request.user) + return ctx class CustomEmailView(LoginRequiredMixin, EmailView): diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html index 1acad0bb87..39309eab73 100644 --- a/InvenTree/templates/InvenTree/settings/user.html +++ b/InvenTree/templates/InvenTree/settings/user.html @@ -39,6 +39,63 @@ +
{% trans 'The following e-mail addresses are associated with your account:' %}
+ + + + {% else %} +{% trans 'Warning:'%} + {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %} +
+ + {% endif %} + + {% if can_add_email %} +