Beispiel #1
0
    def get_redirect_url(self, user_id):
        user = get_object_or_404(get_user_model(), pk=user_id)

        if user.is_active:
            message = ('%s\'s account is already active.'
                       % user.get_familiar_name())
            messages.success(self.request, message)
            return reverse('kanisa_manage_users')

        send_single_mail(user, 'on_account_activation', {})

        send_bulk_mail(users_with_perm('manage_users'),
                       'on_account_activation_staff_notify',
                       {'user': user})

        user.is_active = True
        user.is_spam = False
        user.save()

        message = ('%s\'s account is now activated.'
                   % user.get_familiar_name())
        messages.success(self.request, message)

        cache.delete('kanisa_inactive_users')

        return reverse('kanisa_manage_users')
Beispiel #2
0
    def form_valid(self, form):
        rval = super(KanisaRegistrationView, self).form_valid(form)

        cache.delete('kanisa_inactive_users')

        send_bulk_mail(users_with_perm('manage_users'),
                       'on_account_registration',
                       {'user': form.instance,
                        'site': RequestSite(self.request), })

        return rval
Beispiel #3
0
    def form_valid(self, form):
        rval = super(KanisaRegistrationView, self).form_valid(form)

        cache.delete('kanisa_inactive_users')

        send_bulk_mail(users_with_perm('manage_users'),
                       'on_account_registration', {
                           'user': form.instance,
                           'site': RequestSite(self.request),
                       })

        return rval
Beispiel #4
0
    def get_redirect_url(self, user_id):
        user = get_object_or_404(get_user_model(), pk=user_id)

        send_bulk_mail(users_with_perm('manage_users'),
                       'on_account_spam_staff_notify', {'user': user})

        user.is_active = False
        user.is_spam = True
        user.save()

        message = ('%s\'s account has been marked as spam.' %
                   user.get_familiar_name())
        messages.success(self.request, message)

        cache.delete('kanisa_inactive_users')

        return reverse('kanisa_manage_users')
Beispiel #5
0
    def get_redirect_url(self, user_id):
        user = get_object_or_404(get_user_model(), pk=user_id)

        send_bulk_mail(users_with_perm('manage_users'),
                       'on_account_spam_staff_notify',
                       {'user': user})

        user.is_active = False
        user.is_spam = True
        user.save()

        message = ('%s\'s account has been marked as spam.'
                   % user.get_familiar_name())
        messages.success(self.request, message)

        cache.delete('kanisa_inactive_users')

        return reverse('kanisa_manage_users')