# Redirect to sign-up since they might be able to register anyway. 'invitations/messages/invite_expired.txt', # Redirect to login since there's hopefully an account already. 'invitations/messages/invite_already_accepted.txt', # The invitation was previously accepted, redirect to the login 'invitations/messages/invite_invalid.txt') # Newer behavior: show an error message and redirect. # Error conditions are: no key, expired key or
# Compatibility with older versions: return an HTTP 410 GONE if there signals import user_signed_upįrom allauth. signals import invite_acceptedįrom allauth. models import Invitationįrom invitations. adapters import get_invitations_adapterįrom invitations. app_settings import app_settingsįrom invitations. views import AcceptInviteįrom invitations. Learn more about bidirectional Unicode charactersįrom invitations. To review, open the file in an editor that reveals hidden Unicode characters. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. The imports have been added in for clarity. It receives the user signed up signal, checks for all matching existing EmailAddresses, accepting the relevant invites. So we copy the api of django-invitation's accept url and insert it above our include for django-invitations, pointing to our custom view. We take advantage of the fact that Django's url matching magic follows a "first match principle" the first match that hits is it. This has been tested, but not extensively. Something to consider is that this solution assumes you're using django-allauth as it uses the EmailAddress model of that package.