fixed invite link system

This commit is contained in:
vabene1111 2021-06-05 19:01:05 +02:00
parent a0a673a0c9
commit 913e896906
2 changed files with 5 additions and 6 deletions

View File

@ -143,9 +143,9 @@ class InviteLinkTable(tables.Table):
link = tables.TemplateColumn(
"<a href='{% url 'view_signup' record.uuid %}' >" + _('Link') + "</a>"
)
delete = tables.TemplateColumn(
"<a href='{% url 'delete_invite_link' record.id %}' >" + _('Delete') + "</a>" # noqa: E501
)
# delete = tables.TemplateColumn(
# "<a href='{% url 'delete_invite_link' record.pk %}' >" + _('Delete') + "</a>"
# )
class Meta:
model = InviteLink

View File

@ -227,7 +227,7 @@ class InviteLinkCreate(GroupRequiredMixin, CreateView):
message += _(' to join their Tandoor Recipes space ') + escape(self.request.space.name) + '.\n\n'
message += _('Click the following link to activate your account: ') + self.request.build_absolute_uri(reverse('view_signup', args=[str(obj.uuid)])) + '\n\n'
message += _('If the link does not work use the following code to manually join the space: ') + str(obj.uuid) + '\n\n'
message += _('The invitation is valid until ') + obj.valid_until + '\n\n'
message += _('The invitation is valid until ') + str(obj.valid_until) + '\n\n'
message += _('Tandoor Recipes is an Open Source recipe manager. Check it out on GitHub ') + 'https://github.com/vabene1111/recipes/'
send_mail(
@ -236,7 +236,6 @@ class InviteLinkCreate(GroupRequiredMixin, CreateView):
None,
[obj.email],
fail_silently=False,
)
messages.add_message(self.request, messages.SUCCESS,
_('Invite link successfully send to user.'))
@ -246,7 +245,7 @@ class InviteLinkCreate(GroupRequiredMixin, CreateView):
except (SMTPException, BadHeaderError, TimeoutError):
messages.add_message(self.request, messages.ERROR, _('Email to user could not be send, please share link manually.'))
return HttpResponseRedirect(reverse('list_invite_link'))
return HttpResponseRedirect(reverse('index'))
def get_context_data(self, **kwargs):
context = super(InviteLinkCreate, self).get_context_data(**kwargs)