コード例 #1
0
    def get(self, request, user):
        """
        Retrieve Account Subscriptions
        `````````````````````````````````````

        Return list of subscriptions for an account

        :auth: required
        """

        # This returns a dict with `subscriber` and `subscriptions`
        # Returns `None` if no subscriptions for user
        sub = newsletter.get_subscriptions(user)
        if sub is None or not newsletter.is_enabled():
            return self.respond([])

        return self.respond([{
            'listId': x.get('list_id'),
            'listDescription': x.get('list_description'),
            'listName': x.get('list_name'),
            'email': x.get('email'),
            'subscribed': x.get('subscribed'),
            'subscribedDate': x.get('subscribed_date'),
            'unsubscribedDate': x.get('unsubscribed_date'),
        } for x in sub['subscriptions']])
コード例 #2
0
ファイル: user_subscriptions.py プロジェクト: Kayle009/sentry
    def get(self, request, user):
        """
        Retrieve Account Subscriptions
        `````````````````````````````````````

        Return list of subscriptions for an account

        :auth: required
        """

        # This returns a dict with `subscriber` and `subscriptions`
        # Returns `None` if no subscriptions for user
        sub = newsletter.get_subscriptions(user)
        if sub is None or not newsletter.is_enabled():
            return self.respond([])

        return self.respond([{
            'listId': x.get('list_id'),
            'listDescription': x.get('list_description'),
            'listName': x.get('list_name'),
            'email': x.get('email'),
            'subscribed': x.get('subscribed'),
            'subscribedDate': x.get('subscribed_date'),
            'unsubscribedDate': x.get('unsubscribed_date'),
        } for x in sub['subscriptions']])
コード例 #3
0
    def get(self, request, user):
        """
        Retrieve Account Subscriptions
        `````````````````````````````````````

        Return list of subscriptions for an account

        :auth: required
        """

        # This returns a dict with `subscriber` and `subscriptions`
        # Returns `None` if no subscriptions for user
        sub = newsletter.get_subscriptions(user)
        if sub is None or not newsletter.is_enabled():
            return self.respond([])

        return self.respond([{
            "listId": x.get("list_id"),
            "listDescription": x.get("list_description"),
            "listName": x.get("list_name"),
            "email": x.get("email"),
            "subscribed": x.get("subscribed"),
            "subscribedDate": x.get("subscribed_date"),
            "unsubscribedDate": x.get("unsubscribed_date"),
        } for x in sub["subscriptions"]])
コード例 #4
0
 def __init__(self, *args, **kwargs):
     super(RegistrationForm, self).__init__(*args, **kwargs)
     if not newsletter.is_enabled():
         del self.fields['subscribe']
     else:
         self.fields['subscribe'].help_text = mark_safe(
             "We'd love to keep you updated via email with product and feature announcements, promotions, educational materials, and events. Our updates focus on relevant information and never sell your data to marketing companies. See our <a href=\"%(privacy_link)s\">Privacy Policy</a> for more details."
             .format(privacy_link=settings.PRIVACY_URL, ))
コード例 #5
0
 def handle(self, request):
     return self.respond(
         'sentry/account/security.html', {
             'page': 'security',
             'has_2fa': Authenticator.objects.user_has_2fa(request.user),
             'AUTH_PROVIDERS': get_auth_providers(),
             'has_newsletters': newsletter.is_enabled(),
         })
コード例 #6
0
ファイル: account_security.py プロジェクト: hosmelq/sentry
 def handle(self, request):
     return self.respond(
         'sentry/account/security.html', {
             'page': 'security',
             'has_2fa': Authenticator.objects.user_has_2fa(request.user),
             'AUTH_PROVIDERS': get_auth_providers(),
             'has_newsletters': newsletter.is_enabled(),
         }
     )
コード例 #7
0
ファイル: accounts.py プロジェクト: hosmelq/sentry
 def __init__(self, *args, **kwargs):
     super(RegistrationForm, self).__init__(*args, **kwargs)
     if not newsletter.is_enabled():
         del self.fields['subscribe']
     else:
         # NOTE: the text here is duplicated within the ``NewsletterConsent`` component
         # in the UI
         self.fields['subscribe'].help_text = mark_safe("We'd love to keep you updated via email with product and feature announcements, promotions, educational materials, and events. Our updates focus on relevant information and never sell your data to marketing companies. See our <a href=\"%(privacy_link)s\">Privacy Policy</a> for more details.".format(
             privacy_link=settings.PRIVACY_URL,
         ))
コード例 #8
0
ファイル: useremail.py プロジェクト: zsy785622069/sentry
def verify_newsletter_subscription(sender, **kwargs):
    from sentry import newsletter

    if not newsletter.is_enabled():
        return

    if not sender.is_primary():
        return

    newsletter.update_subscription(
        sender.user,
        verified=True,
        verified_date=timezone.now(),
    )
コード例 #9
0
ファイル: auth_config.py プロジェクト: waterdrops/sentry
    def prepare_login_context(self, request, *args, **kwargs):
        can_register = bool(has_user_registration() or request.session.get("can_register"))

        context = {
            "serverHostname": get_server_hostname(),
            "canRegister": can_register,
            "hasNewsletter": newsletter.is_enabled(),
        }

        if "session_expired" in request.COOKIES:
            context["warning"] = WARN_SESSION_EXPIRED

        context.update(additional_context.run_callbacks(request))

        return context
コード例 #10
0
ファイル: accounts.py プロジェクト: yaoqi/sentry
 def __init__(self, *args, **kwargs):
     super(PasswordlessRegistrationForm, self).__init__(*args, **kwargs)
     if not newsletter.is_enabled():
         del self.fields['subscribe']
     else:
         # NOTE: the text here is duplicated within the ``NewsletterConsent`` component
         # in the UI
         notice = (
             "We'd love to keep you updated via email with product and feature "
             "announcements, promotions, educational materials, and events. "
             "Our updates focus on relevant information, and we'll never sell "
             "your data to third parties. See our "
             "<a href=\"{privacy_link}\">Privacy Policy</a> for more details."
         )
         self.fields['subscribe'].help_text = mark_safe(
             notice.format(privacy_link=settings.PRIVACY_URL))
コード例 #11
0
ファイル: accounts.py プロジェクト: yuan1024/sentry
 def __init__(self, *args, **kwargs):
     super(PasswordlessRegistrationForm, self).__init__(*args, **kwargs)
     if not newsletter.is_enabled():
         del self.fields['subscribe']
     else:
         # NOTE: the text here is duplicated within the ``NewsletterConsent`` component
         # in the UI
         notice = (
             "We'd love to keep you updated via email with product and feature "
             "announcements, promotions, educational materials, and events. "
             "Our updates focus on relevant information, and we'll never sell "
             "your data to third parties. See our "
             "<a href=\"{privacy_link}\">Privacy Policy</a> for more details."
         )
         self.fields['subscribe'].help_text = mark_safe(
             notice.format(privacy_link=settings.PRIVACY_URL))
コード例 #12
0
ファイル: auth_config.py プロジェクト: webZW/sentry
    def prepare_login_context(self, request, *args, **kwargs):
        can_register = bool(auth.has_user_registration()
                            or request.session.get('can_register'))

        context = {
            'serverHostname': get_server_hostname(),
            'canRegister': can_register,
            'hasNewsletter': newsletter.is_enabled(),
        }

        if 'session_expired' in request.COOKIES:
            context['warning'] = WARN_SESSION_EXPIRED

        context.update(additional_context.run_callbacks(request))

        return context