def handle_noargs(self, **options): if askbot_settings.ENABLE_EMAIL_ALERTS: activate_language(django_settings.LANGUAGE_CODE) for user in User.objects.exclude(status='b').iterator(): try: if email_is_blacklisted(user.email) and askbot_settings.BLACKLISTED_EMAIL_PATTERNS_MODE == 'strict': continue self.send_email_alerts(user) except Exception: self.report_exception(user) connection.close()
def handle_noargs(self, **options): if askbot_settings.ENABLE_EMAIL_ALERTS: activate_language(django_settings.LANGUAGE_CODE) for user in User.objects.exclude(status='b').iterator(): try: if email_is_blacklisted( user.email ) and askbot_settings.BLACKLISTED_EMAIL_PATTERNS_MODE == 'strict': continue self.send_email_alerts(user) except Exception: self.report_exception(user) connection.close()
def moderated_email_validator(email): allowed_domains = askbot_settings.ALLOWED_EMAIL_DOMAINS.strip() allowed_emails = askbot_settings.ALLOWED_EMAILS.strip() error_msg = _('this email address is not authorized') if allowed_emails or allowed_domains: if not email_is_allowed(email, allowed_emails=allowed_emails, allowed_email_domains=allowed_domains): raise forms.ValidationError(error_msg) else: from askbot.utils.auth import email_is_blacklisted blacklisting_on = askbot_settings.BLACKLISTED_EMAIL_PATTERNS_MODE != 'disabled' if blacklisting_on and email_is_blacklisted(email): raise forms.ValidationError(error_msg)