diff --git a/organizations/forms.py b/organizations/forms.py index 1c4077f2..8ffb445f 100644 --- a/organizations/forms.py +++ b/organizations/forms.py @@ -97,13 +97,6 @@ def save(self, *args, **kwargs): """ try: user = get_user_model().objects.get(email__iexact=self.cleaned_data['email']) - # Send a notification email to this user to inform them that they - # have been added to a new organization. - invitation_backend().send_notification( - user, - **{'domain': get_current_site(self.request), - 'organization': self.organization, - 'sender': self.request.user}) except get_user_model().MultipleObjectsReturned: raise forms.ValidationError(_("This email address has been used multiple times.")) except get_user_model().DoesNotExist: @@ -112,6 +105,13 @@ def save(self, *args, **kwargs): **{'domain': get_current_site(self.request), 'organization': self.organization, 'sender': self.request.user}) + # Send a notification email to this user to inform them that they + # have been added to a new organization. + invitation_backend().send_notification(user, **{ + 'domain': get_current_site(self.request), + 'organization': self.organization, + 'sender': self.request.user, + }) return OrganizationUser.objects.create(user=user, organization=self.organization, is_admin=self.cleaned_data['is_admin']) diff --git a/organizations/templates/organizations/email/notification_body.html b/organizations/templates/organizations/email/notification_body.html index 6fd8a344..c14281c7 100644 --- a/organizations/templates/organizations/email/notification_body.html +++ b/organizations/templates/organizations/email/notification_body.html @@ -1,4 +1,4 @@ -You've been added to the organization {{ organization|safe }} on {{ domain.name }} by {{ sender.first_name|safe }} {{ sender.last_name|safe }}. +You've been added to the organization {{ organization|safe }} on {{ domain.name }} by {{ sender.full_name|safe }}.` Follow the link below to view this organization.