Esempio n. 1
0
    def clean(self):
        """
        Make sure email is not already in the system.
        """
        cleaned_data = super(InviteMemberForm, self).clean()
        email = cleaned_data.get('email')
        validate_email_availability(email)

        return cleaned_data
Esempio n. 2
0
    def clean(self):
        """
        Make sure email is not already in the system.
        """
        cleaned_data = super(InviteMemberForm, self).clean()
        email = cleaned_data.get('email')
        validate_email_availability(email)

        return cleaned_data
Esempio n. 3
0
    def clean(self):
        """
        - Check that the user id is valid.

        - If the moderator changes the email, make sure the new
        email is not already in the system.
        """
        cleaned_data = super(ReInviteMemberForm, self).clean()
        email = cleaned_data.get('email')
        user_id = cleaned_data.get('user_id')

        user = get_object_or_404(User, id=user_id)

        if (user.moderator != self.logged_in_moderator or not user.is_invited_pending_activation()):
            raise Http404

        # If this email is not already registered to this user
        if email != user.email:
            validate_email_availability(email)

        return cleaned_data
Esempio n. 4
0
    def clean(self):
        """
        - Check that the user id is valid.

        - If the moderator changes the email, make sure the new
        email is not already in the system.
        """
        cleaned_data = super(ReInviteMemberForm, self).clean()
        email = cleaned_data.get('email')
        user_id = cleaned_data.get('user_id')

        user = get_object_or_404(User, id=user_id)

        if (user.moderator != self.logged_in_moderator
                or not user.is_invited_pending_activation()):
            raise Http404

        # If this email is not already registered to this user
        if email != user.email:
            validate_email_availability(email)

        return cleaned_data